dataGrid中显示列:ItemID,ItemCode,ItemName,Note
一、选中一行
1 var selRow = $('#dataGrid').datagrid('getSelected'); 2 if(selRow != null){ 3 alert('ItemID:' + selRow.ItemID); 4 }View Code
二、选中多行
1 var idArray = []; 2 var selRows = $('#dataGrid').datagrid('getSelections'); 3 if(selRows != null && getSelected.length > 0){ 4 for(var index = 0;index < selRows.length;index++){ 5 idArray.push(selRows[index].ItemID); 6 } 7 } 8 //用逗号将itemID分开并拼接成字符串 9 var itemIDs = idArray.join(',');View Code
参照来源:http://www.jeasyui.net/tutorial/23.html