我正在使用jqGrid來呈現一些數據。現在我希望能夠根據兩個不同選擇框的值修改數據。例如,我有一個位置ID的下拉列表和日期範圍的下拉列表。我想根據位置ID和日期範圍進行過濾,在我的/something/search
操作中處理此邏輯。我怎樣才能將這些額外的數據動態地傳遞給jqGrid?因此,(1)初始負載和(2)當onChange事件被觸發,我會像{data: {location_id: 10, range_start: '1/1/2012', range_end: '1/5/2010'}}
通過。如果需要的話 包括我現有的代碼::然後我可以讀這作爲一個PARAM,就像我對"page", "rows", "sidx"
做,等等。如何動態傳遞數據以使用jqGrid進行搜索?
編輯
grid.jqGrid({
url: "/something/search",
datatype: "json",
colNames: ['', 'ID', 'Description', 'Start', 'End', 'Last Updated'],
colModel: [{name:'act',index:'act', width:16,sortable:false},
{ name: 'id', index: 'id', width: 100, hidden: true },
{ name: 'description', index: 'description', width: 200 },
{ name: 'start_date', index: 'start_date', width: 120 },
{ name: 'end_date', index: 'end_date', width: 120 },
{ name: 'last_update', index: 'last_update', width: 120 }],
rowNum: 20,
rowList: [10, 20, 50],
pager: '#data-list-pager',
sortname: 'ident',
viewrecords: true,
sortorder: "desc",
multiselect: false,
height: "100%",
caption: "",
altRows: true,
width: 865});
感謝。我擁有的數據將不會在jqGrid中返回,但我會查看postData。 – 2012-02-02 19:06:38
@RonGarrity:不客氣! – Oleg 2012-02-02 21:31:24