Javascript 带动态加载数据的ExtJS 4.2.0 RowExpander
我想使用ExtJs插件“RowExpander”,但是,我会在触发事件expandbody时加载数据。 我尝试过这段代码,但不知道如何设置rWebody的内容:Javascript 带动态加载数据的ExtJS 4.2.0 RowExpander,javascript,plugins,extjs,Javascript,Plugins,Extjs,我想使用ExtJs插件“RowExpander”,但是,我会在触发事件expandbody时加载数据。 我尝试过这段代码,但不知道如何设置rWebody的内容: this.GridPrincipal.getView().addListener('expandbody', function (rowNode, record, expandRow, eOpts) { Ext.Ajax.request({ url: 'getData/' + record.g
this.GridPrincipal.getView().addListener('expandbody', function (rowNode, record, expandRow, eOpts) {
Ext.Ajax.request({
url: 'getData/' + record.get('id'),
method: 'POST',
success: function (result, request) {
// retrive the data
var jsonData = Ext.util.JSON.decode(result.responseText);
//code to change the text of the RowBody
//....
},
failure: function (result, request) {
Ext.MessageBox.alert('Failed', result.responseText);
return false;
}
});
});
非常感谢。我也有同样的问题。我的解决办法是:
Ext.get(expandRow).setHTML('New Text');
我很想知道是否有更好的方法。可以将任何数据甚至其他组件渲染到扩展器中的一个解决方案是为其分配一个div
plugins: [{
ptype: 'rowexpander',
rowBodyTpl: ['<div id="ux-row-expander-box-{id}"></div>'],
expandOnRender: true,
expandOnDblClick: true
}]
插件:[{
p类型:“行扩展器”,
rowBodyTpl:[''],
expandOnRender:true,
expandOnDblClick:true
}]
其中“id”是您商店的id字段
接下来在expandbody事件中,您可以使用Ajax请求获取数据,然后使用renderTo配置将包含数据的面板或网格等呈现到此div中