开发者

JqGrid select current data

开发者 https://www.devze.com 2023-03-15 01:43 出处:网络
I am using jqGrid and I want to select specific column values on the clicked row Here is what I am doing, but I am not getting it. Please help. I am tryingto get cfgId of

I am using jqGrid and I want to select specific column values on the clicked row

Here is what I am doing, but I am not getting it. Please help. I am trying to get cfgId of

$('#configDiv').empty();
            $('<div width="100%">')
            .attr('id','configDetailsGrid')
            .html('<table id="list1" width="100%"></table>'+
                    '<div id="gridpager"></div>'+
                '</div>')       
            .appendTo('#configDiv');    

            var grid = jQuery("#list1");

            grid.jqGrid({

              datastr : xml,
              datatype: 'xmlstring',
              colNames:['cfgid','','Name', 'Host', 'Description','Product', 'Type', 'Last Updated Time','Last Updated By',''],
              colModel:[
                  {name:'cfgId',index:'cfgId', width:90, align:"right", hidden:true},
                  {name:'',index:'', width:15, align:"right",edittype:'checkbox',formatter: "checkbox",editoptions: { value:"True:False"},editable:true,formatoptions: {disabled : false}},
                  {name:'cfgName',index:'cfgName', width:90, align:"right"},
                  {name:'hostname',index:'hostname', width:90, align:"right"},
                  {name:'cfgDesc',index:'cfgDesc', width:90, align:"right"},
                  {name:'productId',index:'productId', width:60, align:"right"},
                  {na开发者_运维知识库me:'cfgType',index:'cfgType', width:60, align:"right"},
                  {name:'updateDate',index:'updateDate', width:120, align:"right"},
                  {name:'emailAddress',index:'emailAddress', width:120, align:"right"},
                  {name:'absolutePath',index:'absolutePath', width:90, align:"right", hidden:true},
              ],
              pager : '#gridpager',
              rowNum:10,
              scrollOffset:0,
              height: 'auto',

              autowidth:true,
              viewrecords: true,
              gridview: true,
              xmlReader: {
                  root : "list",
                  row: "com\\.abcd\\.db\\.ConfigInfo",
                  userdata: "userdata",
                  repeatitems: false
              },
              onSelectRow: function(id){
                  //var userdata = jQuery("#list").getGridParam('userData');
                  //var listid = jQuery('#list').getCell(id, "cfgid");
                  //var listid = $('#list').jqGrid('getCell', id, 'Name');
                  var abc=jQuery("#list").getRowData(id);
                  alert(abc.cfgId);
                  }

            });
            grid.jqGrid('navGrid','#gridpager',{edit:false,add:false,del:false});


Use this

onSelectRow: function(id){
                  var rowData = jQuery(this).getRowData(id); 
                  configid = rowData['cfgId'];

                  }
0

精彩评论

暂无评论...
验证码 换一张
取 消