I'm applying the jquery UI Multiselect Widget for filter of jqGrid from Oleg's answer. It works fine. But there is a problem when using 2 grids that have two similar columns.
These columns (in two different grids) have same value for "name" property. So the element Id of two these filters are same. Because of this, when I select value of multiselect filter of the second grid, but the effect occurs on filter of the first grid.
Example: in the following screenshots, if i choose a value of filter 2, the same value of filter 1 will be selected instead.
Grid 1 column model:
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 }
];
Grid 2 column model
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 }
];
Is there anyway to custom the Id of filter or something like that to prevent this issue?