1.定义方法
/**
* 加载数据
*/
function _dataGridLoad(callback) {
<span style="white-space:pre"> </span>var dataGrid = me.view.getDataGrid();
<span style="white-space:pre"> </span>var filter = {};
<span style="white-space:pre"> </span>filter.midware_ip = me.view.objID;
<span style="white-space:pre"> </span>filter.type = me.view.loadType;
<span style="white-space:pre"> </span>dataGrid.setFilter(filter);
<span style="white-space:pre"> </span>dataGrid.load();
<span style="white-space:pre"> </span>if (callback instanceof Function)
<span style="white-space:pre"> </span>callback(me.view.loadType)
}
<span style="white-space:pre"> </span>
2.使用
_dataGridLoad(function(e) {
<span style="white-space:pre"> </span>if (e != "2")
<span style="white-space:pre"> </span>return;
<span style="white-space:pre"> </span>var toolBar = me.view.getToolBar();
<span style="white-space:pre"> </span>toolBar.items[0].setVisible(true);
<span style="white-space:pre"> </span>toolBar.items[1].show();
<span style="white-space:pre"> </span>me.view.getDataGridToolBar().show();
<span style="white-space:pre"> </span>var dataGrid = me.view.getDataGrid();
<span style="white-space:pre"> </span>dataGrid.setHeight(document.body.offsetHeight - 100);
<span style="white-space:pre"> </span>dataGrid.setAllowEditing(true);
});