Datagrid动态设置列标题的的扩展方法
01 | $.extend($.fn.datagrid.methods, { |
02 | setColumnTitle: function (jq, option){ |
03 | if (option.field){ |
04 | return jq.each( function (){ |
05 | var $panel = $( this ).datagrid( "getPanel" ); |
06 | var $field = $( 'td[field=' +option.field+ ']' ,$panel); |
07 | if ($field.length){ |
08 | var $span = $( "span" ,$field).eq(0); |
09 | $span.html(option.text); |
10 | } |
11 | }); |
12 | } |
13 | return jq; |
14 | } |
15 | }); |
使用方法:
1 | $( "#dt" ).datagrid( "setColumnTitle" ,{field: 'productid' ,text:'newTitle |