为了账号安全,请及时绑定邮箱和手机立即绑定

如何在jqgrid中添加新行后触发loadComplete?

如何在jqgrid中添加新行后触发loadComplete?

有只小跳蛙 2019-07-23 15:20:22
如何在jqgrid中添加新行后触发loadComplete?我有一个自定义格式化程序,它在jqgrid的loadComplete中触发。在动态添加行时,需要使用相同的自定义格式化程序。所以我想像任何正常的函数一样调用loadComplete()。自定义格式化程序在加载网格时运行良好,但在以后添加行时不会生效。动态添加行function addRow(cfgid,cfgname,hostname,osname,cfgDesc,productId,cfgType,updateDate,emailAddress,absolutePath,fileName,productVersion,converted){     var myrow = {cfgId:cfgid, '':'', cfgName:cfgname, hostname:hostname, osname:osname, cfgDesc:cfgDesc, productId:productId,hostname:hostname,cfgType:cfgType,updateDate:updateDate,emailAddress:emailAddress,absolutePath:absolutePath,fileName:fileName,productVersion:productVersion,converted:converted};     $("#list1").addRowData(cfgid, myrow,"first");     //$("#list1").loadComplete(); does not work     $("#list1").trigger("reloadGrid");     $("#list1").sortGrid('updateDate', true, 'desc');}jqGrid的function drawDynamicGrid(xml){     var emptyMsgDiv = $('<div>No configurations loaded</div>');     var xmlObject=StringtoXML(xml);     var getColumnIndexByName = function (grid, columnName) {         var cm = grid.jqGrid('getGridParam', 'colModel'), i = 0, l = cm.length;         for (; i < l; i += 1) {             if (cm[i].name === columnName) {                 return i; // return the index             }         }         return -1;     },     grid = jQuery("#list1"),     convertIcon = '<span class="ui-state-default" style="border:0" id="converted"><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span></span>',     iconAlert = '<span class="ui-state-error" style="border:0" id="expired"><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span></span>';     grid.jqGrid({       datastr : xml,       datatype: 'xmlstring',       colNames:['cfgId','Name', 'Host','Operating System', 'Description','Product', 'Type', 'Last Updated Time','Last Updated By','','','',''],       colModel:[           {name:'cfgId',index:'cfgId', width:90, align:"left", hidden:true},       ],             }         }         }     });
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1374 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信