addTab: function() { $("#myTabs").tabs(‘add‘, { title: ‘my title‘, closable: true, tools: [{ iconCls: ‘icon-mini-refresh‘, handler: function() { alert(‘refresh‘); } }] }); var currentTabPanel = $("#tabsMain").tabs(‘getSelected‘); var dynamicTable = $(‘<table id="tbTest"></table>‘); //这里一定要先添加到currentTabPanel中,因为dynamicTable.datagrid()函数需要调用到parent函数 currentTabPanel.html(dynamicTable); dynamicTable.datagrid({ url:‘datagrid_data.json‘, columns:[[ {field:‘code‘,title:‘Code‘,width:100}, {field:‘name‘,title:‘Name‘,width:100}, {field:‘price‘,title:‘Price‘,width:100,align:‘right‘} ]] }); }
时间: 2024-10-24 21:50:11