我应用jquery UI Multiselect Widget来过滤来自Oleg's answer的jqGrid。它工作正常。但是当使用具有两个相似列的2个网格时存在问题。
这些列(在两个不同的网格中)具有相同的值" name"属性。因此,这两个过滤器的元素Id是相同的。因此,当我选择第二个网格的多选滤波器的值时,会在第一个网格的滤波器上产生效果。
示例:在以下屏幕截图中,如果我选择过滤器2的值,则会选择相同的过滤器1值。
网格1列模型:
grid1ColumnModel = [
{ label: 'PrefRetRuleTierID', name: 'PrefRetRuleTierID', index: 'PrefRetRuleTierID', hidden: true, hidedlg: true },
{ label: 'PrefRetRuleID', name: 'PrefRetRuleID', index: 'PrefRetRuleID', hidden: true, hidedlg: true },
{
label: 'Transaction Set', name: 'TierID', index: 'TierID', width: 230, editable: false, hidedlg: true,
edittype: 'select', formatter: 'select',
editoptions: { value: GetDataFromWebMethod(grid1_URLTier, '') },
stype: 'select',
searchoptions: {
value: initGridFilterData(grid1_URL_Load_Filter_Tier_By_PrefRetRuleId, ddlSelector, 0, 'tierId', 0),
sopt: ["eq"],
attr: { multiple: 'multiple', size: 3 },
dataInit: dataInitMultiselect
},
sorttype: Grid1_SortByText_TierID
},
{
label: 'Switch Pos / Neg Sign', name: 'SwitchSign', index: 'SwitchSign', editable: false, width: 110,
align: 'center', edittype: 'checkbox', editoptions: { value: 'true:false' }, formatter: 'checkbox',
stype: 'select', searchoptions: {
value: ':All;true:Yes;false:No',
sopt: ["eq"],
attr: { multiple: 'multiple', size: 3 },
dataInit: dataInitMultiselect
}
},
{ label: 'Comments', name: 'Comments', index: 'Comments', editable: false },
{ name: CRUDIndex, index: CRUDIndex, hidden: true, hidedlg: true }
];
网格2列模型
grid2ColumnModel = [
{ label: 'TierFilterID', name: 'TierFilterID', index: 'TierFilterID', hidden: true, hidedlg: true },
{ label: 'PrefRetRuleID', name: 'PrefRetRuleID', index: 'PrefRetRuleID', hidden: true, hidedlg: true },
{
label: 'Transaction Set', name: 'TierID', index: 'TierID', editable: false, hidedlg: true,
edittype: 'select', formatter: 'select',
editoptions: { value: GetDataFromWebMethod(grid2_URLTier, '')},
stype: 'select',
searchoptions: {
value: initGridFilterData(grid1_URL_Load_Filter_Tier_By_PrefRetRuleId, ddlSelector, 0, 'tierId', 0),
sopt: ["eq"],
attr: { multiple: 'multiple', size: 3 },
dataInit: dataInitMultiselect
},
sorttype: Grid2_SortByText_TierID
},
{
label: 'Filter Field', name: 'UDFFieldID', index: 'UDFFieldID', editable: false, hidedlg: true,
edittype: 'select', formatter: 'select',
editoptions: { value: GetDataFromWebMethod(grid2_URL_UDFField), dataUrl: grid2_URL_UDFField, buildSelect: buildList },
stype: 'select', searchoptions: {
//dataUrl: grid2_URL_UDFField, buildSelect: buildList
value: GetDataFromWebMethod(grid2_URL_UDFField),
sopt: ["eq"],
attr: { multiple: 'multiple', size: 3 },
dataInit: dataInitMultiselect
},
sorttype: Grid2_SortByText_UDFFieldID
},
{
label: 'Filter Criteria', name: 'FilterCriteria', index: 'FilterCriteria', editable: false, hidedlg: true,
edittype: 'select', formatter: 'select', align: 'center',
editoptions: { value: ':;=:=;<>:<>;>:>;>=:>=;<=:<=' }, stype: 'select',
searchoptions: {
value: ':;=:=;<>:<>;>:>;>=:>=;<=:<=',
sopt: ["eq"],
attr: { multiple: 'multiple', size: 3 },
dataInit: dataInitMultiselect
}
},
{ label: 'Value', name: 'FilterValue', index: 'FilterValue', editable: false, hidedlg: true },
{ name: CRUDIndex, index: CRUDIndex, hidden: true, hidedlg: true }
];
是否有自定义过滤器的ID或类似的东西以防止此问题?