[英]Common Exposed filter for each tab in drupal 7
我有不同的字段並在不同的塊中顯示,並且想要對所有對象都應用暴露的濾鏡,但是我的問題是,每個不同的塊都顯示不同的暴露的濾鏡。 我想使每個塊通用。
以下是步驟,
現在,每個塊顯示其不同的暴露濾鏡。 但是我希望裸露的濾鏡應該顯示在按鈕上方,並且應該適用於每個塊顯示。 隨附問題截圖。
我安裝了Views Global Filter
但顯示Session error
。
我只是要建議“視圖全局過濾器”。
另一種方法是在所有從URL提取的塊上設置上下文過濾器,以便它們各自提取相同的值。 這是視圖問題隊列中的一個活躍問題,有一些使它起作用的人: https : //www.drupal.org/node/1587894評論#6有一些簡單的代碼,可以在這里應用https: //www.drupal.org/node/1871388
3天后,即使通過編程方式,我仍未找到解決方案。
然后我最后的選擇(在我看來,呵呵)是
下面是我的js file
所需的一段代碼。
// Active target element to make the tab/button active after
// ajax responds in filter
var activeTargetElement;
Drupal.behaviors.events = {
attach: function (context, settings) {
$('#views-exposed-form-MY_VIEW_MACHINE_NAME-BLOCK_NAME', context).ajaxStart(function () {
// my tabs/button are active on the basis of data-target attribute,
// so need to memorise which tab/button is active before fitering any language
activeTargetElement = $('#MY_TABS li.active a').data('target');
}).ajaxSuccess(function () {
// if any target is memorised, then simply click it or trigger a click event for it
if($('[data-target="'+activeTargetElement+'"]').length){
$('[data-target="'+activeTargetElement+'"]').click();
}
});
}
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.