jQuery datagrid 即时选择

  • Post author:
  • Post category:其他






$(“#ListTable”).datagrid({






onSelect: function (rowIndex, rowData) {








var BatchStr = rowData.RR_ID;








$(‘#BatchRR_IDStr’).val($(‘#BatchRR_IDStr’).val()+”,”+BatchStr);






},






onUnselect: function (rowIndex, rowData) {








var selectedstr = $(‘#BatchRR_IDStr’).val().substring(1, $(‘#BatchRR_IDStr’).val().length);








var selectarray = selectedstr.split(‘,’);








for (var i = 0; i < selectarray.length; i++)








{










if (rowData.RR_ID==selectarray[i])










{












for (var j = i; j < selectarray.length-1; j++)












{














selectarray[j] = selectarray[j + 1];












}










}








}








var selectstrnew = “”;








for (i = 0; i < selectarray.length – 1; i++) {










selectstrnew += “,” + selectarray[i];








}








$(‘#BatchRR_IDStr’).val(selectstrnew);






},






onSelectAll: function (rows) {








var BatchStr = “”;








for (i = 0; i < rows.length; i++) {










BatchStr += “,” + rows[i].RR_ID;








}








$(‘#BatchRR_IDStr’).val(BatchStr.substring(1, BatchStr.length));






},








onUnselectAll: function (rows) {










$(‘#BatchRR_IDStr’).val(“”);








}




})



版权声明:本文为renkangkangren原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。