datagrid选择一行

1 onLoadSuccess:function(value, rec){
2   $("#sinopec_search_btn").linkbutton('enable');
3   var data = $('#sinopec_list').datagrid("getData").rows;
4   $.each(data,function(idx,obj){//遍历JSON
5      if ('${param.systemid}' == (obj.systemid)) {
6      $('#sinopec_list').datagrid("selectRow", idx);//如果已选中则选中该行
7      }
8   });
9 }

selectRow   index     选择一行,行索引从0开始。

checkRow   index   勾选一行,行索引从0开始。

selectRecord  idValue   通过ID值参数选择一行。

  $(selector).each(function(index,element))
  • index - 选择器的 index 位置
  • element - 当前的元素(也可使用 "this" 选择器)

 注:

  id属性注掉||id属性值改对 

原文地址:https://www.cnblogs.com/hym-pcitc/p/5660025.html