如果你在我的代碼看到這裏,我在我的網格中也使用ondblClickRow
。如果您看到此處,我將獲取所有行值並根據需要進行自己的更改,最後使用document.location.href
加載作業詳細信息頁面。
我能夠對網格中的所有行執行此操作。
ondblClickRow: function(rowId) {
var rowData = jQuery(this).getRowData(rowId);
var jobNumber = rowData['jobNumber'];
var jobName = rowData['description'];
var jobCustomer = rowData['customerName'];
var jobStatus = rowData['jobStatus'];
jobName = jobName.replace(/&/g, "``");
jobName = jobName.replace(/#/, "__");
var aQryStr = "jobNumber=" + jobNumber + "&jobName=" + jobName + "&jobCustomer=" + jobCustomer;
console.log("./jobflow?token=view&" + aQryStr);
document.location.href = "./jobflow?token=view&" + aQryStr;
},
如果你想看到我滿格代碼:
$("#jobsGrid").jqGrid({
url:'../job_controller',
datatype: 'JSON',
mtype: 'POST',
pager: jQuery('#jobsGridPager'),
colNames:['Job #','Project','City', 'Rep', 'Status', 'Customer', 'Cust PO #', 'Rep. #'],
colModel :[
{name:'jobNumber', index:'jobNumber', align:'left', width:50, editable:true,hidden:false, edittype:'text',
editoptions:{size:30,readonly:true},editrules:{edithidden:false,required:false}},
{name:'description', index:'description', align:'left', width:150,hidden:false, editable:true,
editoptions:{size:20,readonly:false, alignText:'right'},editrules:{edithidden:true,required:true}},
{name:'locationCity', index:'locationCity', align:'', width:90,hidden:false, editable:true,
editoptions:{size:20,readonly:false, alignText:'right'},editrules:{edithidden:true,required:true}},
{name:'initials', index:'initials', align:'center', width:30,hidden:false, editable:true,
editoptions:{size:20,readonly:false, alignText:'right'},editrules:{edithidden:true,required:true}},
{name:'jobStatus', index:'jobStatus', align:'center', width:60,hidden:false, editable:true,
editoptions:{size:20,readonly:false, alignText:'right'},editrules:{edithidden:true,required:true}},
{name:'customerName', index:'customerName', align:'', width:150,hidden:false, editable:true,
editoptions:{size:20,readonly:false, alignText:'right'},editrules:{edithidden:true,required:true}},
{name:'customerPONumber', index:'customerPONumber', align:'center', width:90, hidden:false, editable:true,
editoptions:{}, editrules:{edithidden:true,required:false}},
{name:'code', index:'code', align:'center', width:40,hidden:false, editable:true,
editoptions:{size:20,readonly:false, alignText:'right'},editrules:{edithidden:true,required:true}}
],
rowNum: 50, pgbuttons: true,
recordtext: '',
rowList: [50, 100, 200, 500, 1000],
viewrecords: true,
pager: '#jobsGridPager',
sortname: 'employeeId', sortorder: "asc", imgpath: 'themes/basic/images', caption: 'Jobs',
height:547, width: 1140,/*scrollOffset:0,*/ rownumbers:true, altRows: true, altclass:'myAltRowClass', rownumWidth: 45,
ondblClickRow: function(rowId) {
var rowData = jQuery(this).getRowData(rowId);
var jobNumber = rowData['jobNumber'];
var jobName = "" + rowData['description'];
var jobCustomer = rowData['customerName'];
var jobStatus = rowData['jobStatus'];
jobName = jobName.replace(/&/g, "``");
jobName = jobName.replace(/#/, "__");
var aQryStr = "jobNumber=" + jobNumber + "&jobName=" + jobName + "&jobCustomer=" + jobCustomer;
console.log("./jobflow?token=view&" + aQryStr);
document.location.href = "./jobflow?token=view&" + aQryStr;
},
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "id",
userdata: "userdata"
}
}).navGrid('#jobsGridPager', add:false,edit:false,del:false,refresh:false,search:false}
);
爲什麼你使用'sel_id',而不是代替'rowid'參數的使用情況如何?如果你總是使用相同的'rowid'參數值,你應該驗證你是否正確填充了數據。在這種情況下,你可以在你的問題中包含jqGrid的更多完整定義(例如,使用'multiselect:true'可能會很有趣),幷包含測試數據(至少兩行數據)。 – Oleg
嗯,我最初是使用下面的代碼,但我有同樣的問題, – nsilva
ondblClickRow:功能(ROWID) \t \t { \t \t VAR rowData =新的Array(); \t \t \t rowData = $(「#bookings」)。getRowData(rowid); $(「#cp-bookings-dialog」)。dialog({hide:'slide',height:625,width:733,title:'Booking Reference:''+ rowData ['bookref']}); \t \t}, – nsilva