0

我正在应用 jquery UI Multiselect Widget 来过滤Oleg's answer中的 jqGrid 。它工作正常。但是在使用具有两个相似列的 2 个网格时会出现问题。

这些列(在两个不同的网格中)具有相同的“名称”属性值。所以这两个过滤器的元素 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或类似的东西来防止这个问题?

4

0 回答 0