3

I have created a jqGrid grid with a drop down list, this list (due to dev restraints) needs to be loaded once, so that all data returned can be filtered, all this is cool so far,

The problem arrives when the drop down list is changed, though the majority of the filtering/searching is done client-side, I need the drop down list to trigger a call that will refresh the page using the newly added parameter from the drop down list.

I have enclosed the section of code that builds the toolbar search, but I have no idea how to add the functionality to catch the event handler when changing the select value, in this only instance I need a non-standard code to be executed - e.g function callNewData()

colNames:["Rent Due Date ","Tenant","Description","Address","Payment Ref.","Rent     Amount","Outstanding","Amount     Received","Confirm?","tenancyID","tenantID","rentID","existingRent"],
    colModel :[{
        name:"rentDueDate", 
        index:"rentDueDate", 
        align:"center", 
        width:"130", 
        search:true, 
        stype:"select",
        searchoptions: {
            value: "all:All;due:Due;overdue:Overdue;future:+1 Week;" ,
            defaultValue:"due"
        }
    },

Where in the search options (or in the colModel) would I put the onChange event Handler?

4

1 回答 1

4

抱歉,但不清楚您的确切问题是什么。如果用户从下拉列表中选择一个选项,那么 jqGrid 会自动使用用户选择的过滤器重新加载网格。如果您使用本地datatype,则过滤将由 jqGrid 在内部完成。如果您使用datatype: "json"datatype: "xml"不使用loadonce: true,则 jqGrid 向服务器发送请求,将有关过滤器的信息附加到标准参数列表中。

如果你真的需要处理onChange事件,<select>那么你需要在里面定义change事件处理程序dataEvents

searchoptions: {
    value: "all:All;due:Due;overdue:Overdue;future:+1 Week;",
    defaultValue: "due",
    dataEvents: [ 
        {
            type: "change",
            fn: function (e) {
                // some code which will be executed onChange
            }
        }
    ]
}
于 2013-04-22T20:35:10.483 回答