js获取表格视图所选行号的ids

实例化数组

遍历所选行push到数组中

将数组join转换为以,分割的字符串

      /*获取指定id的datagrid的表格视图的选择的ids*/
      function getDataGridSelectRowIDS(id){
           var ids = [];
           var rows = $('#'+id).datagrid('getSelections');  //获取所选行,具体获取方式根据框架不同而变
           for(var i=0; i//遍历行
            ids.push(rows[i].id);  //将行数据id加入到数组中
        }
        var idsStr = ids.join(',');  //将数组转换为以,分割的字符串
        //console.info(idsStr);
        //console.info(rows.length);
        return ids;
      }

 

点赞

Leave a Reply

Your email address will not be published. Required fields are marked *