当我点击页面上的某个按钮后调用了一个方法
在这个方法里如何能更新store的数据的连接url呀
具体代码为
var unit = '100000'
function getdetail(node,e){
alert(node.attributes.dwdm);
unit = '222222';
var url = '../back/Modelaction_getunitfillinfo.action?unitid='+unit;
store.reload();
alert(unit);}
var store = new Ext.data.Store({
autoLoad:true,
reader: reader,
url:'../back/Modelaction_getunitfillinfo.action?unitid='+unit
});
是用store的reload方法吗?
//////////////////////////////
全部代码如下 就是想做在Tree上双击后获取 一个 url 给 store 的数据及加载数据
Ext.BLANK_IMAGE_URL = '../ext/resources/images/default/s.gif';
Ext.QuickTips.init();
Ext.onReady(function(){
var url = '/apollo/back/Modelaction_getinfo.action?taskid='+taskid;
var page = '';
var store = new Ext.data.SimpleStore({
fields:['tasktime','tasktimeid'],
autoLoad:true,
url:'../back/Taskaction_gettasktimedata.action?taskid='+taskid
});
var cbo = new Ext.form.ComboBox({
triggerAction:'all',
store:store,
displayField:'tasktime',
valueField:'tasktimeid',
value:'请选择任务时间',
readOnly:true,
mode:'remote',
forceSelection:true,
resizable:true,
typeAhead:true,
id:'tasktime'
});
function t(combo){
url = '../back/Modelaction_getfillstateinfo.action?taskid='+taskid+'&tasktimeid='+combo.value;
//alert(combo.value+' = = = '+taskid+url);
loader.dataUrl = url;
root.reload();
root.expand();
}
cbo.on('select',t);
var tbar = new Ext.Toolbar({
region:'north',
items:['-','任务时间:',cbo,'-',{
text : '上报情况',
minWidth:90,
listeners : {click : function(button, e) {
var cbotime = Ext.getCmp('tasktime');
alert(cbotime.value);
/*
page = 'dataexchange/datainfo.jsp';
panel.load({url:page,scripts:true});*/
}
}
}]
});
var root = new Ext.tree.AsyncTreeNode({
dwdm:rootid,
text:rootname
});
var loader = new Ext.tree.TreeLoader({
dataUrl:url,
//dataUrl:'dataexchange/data.jsp',
uiProviders:{'col':Ext.tree.ColumnNodeUI}
});
loader.on('beforeload', function(treeloader, node) {
treeloader.baseParams = {
dwdm:node.attributes.dwdm
};
}, this);
var tree = new Ext.tree.ColumnTree({
region: 'center',
fill:true,
height:500,
layout:'fit',
margins: '2 2 0 2',
autoScroll: true,
autoWidth:true,
columns:[{
header:'单位名称',
width:250,
dataIndex:'unitname'
},{
header:'是否填报',
width:80,
dataIndex:'isfinish'
},{
header:'填报时间',
width:150,
dataIndex:'finsihdate'
},{
header:'是否审核',
width:80,
dataIndex:'ifcheck'
},{
header:'审核时间',
width:150,
dataIndex:'checkdate'
},{
header:'审核人',
width:100,
dataIndex:'checkperson'
},{
header:'是否批复',
width:80,
dataIndex:'ifallow'
},{
header:'批复时间',
width:150,
dataIndex:'allowdate'
},{
header:'批复人',
width:100,
dataIndex:'allowperson'
}],
loader:loader,
root:root
});
tree.on('dblclick',getdetail);
var unit = '100000'
function getdetail(node,e){
alert(node.attributes.dwdm);
unit = '222222';
var url = '../back/Modelaction_getunitfillinfo.action?unitid='+unit;
store.load();
//alert(unit);
//store.url = '../back/Modelaction_getfillstateinfo.action?unitid=100000000';
// alert(node.attributes.unitname);
// alert(node.attributes.isfinish);
// alert(node.attributes.finsihdate);
// alert(node.attributes.ifcheck);
// alert(node.attributes.checkdate);
// alert(node.attributes.checkperson);
// alert(node.attributes.ifallow);
// alert(node.attributes.allowdate);
// alert(node.attributes.allowperson);
//Ext.Msg.alert('title',node.attributes.allownote);
windelail.show();
}
var viewport = new Ext.Viewport({
autoScroll:true,
renderTo:Ext.getBody(),
items:[tbar,tree]
});
/****************/
var reader = new Ext.data.ArrayReader({}, [
{name: 'company'},
{name: 'price', type: 'float'},
{name: 'change', type: 'float'},
{name: 'pctChange', type: 'float'},
{name: 'lastChange', type: 'date', dateFormat: 'Y-m-d'},
{name: 'industry'},
{name: 'desc'}
]);
var expander = new Ext.grid.RowExpander({
tpl : new Ext.Template(
'<p><b>Company:</b> {company}</p><br>',
'<p><b>Summary:</b> {desc}</p>'
)
});
var store = new Ext.data.Store({
autoLoad:true,
reader: reader,
url:'../back/Modelaction_getunitfillinfo.action?unitid='+unit
});
var grid1 = new Ext.grid.GridPanel({
store: store,
cm: new Ext.grid.ColumnModel([
expander,
{id:'company',header: "Company", width: 40, sortable: true, dataIndex: 'company'},
{header: "Price", width: 20, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
{header: "Change", width: 20, sortable: true, dataIndex: 'change'},
{header: "% Change", width: 20, sortable: true, dataIndex: 'pctChange'},
{header: "Last Updated", width: 20, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
]),
viewConfig: {
forceFit:true
},
width: 490,
height: 495,
plugins: expander,
animCollapse: false,
title: 'Expander Rows, Collapse and Force Fit',
iconCls: 'icon-grid'
});
var windelail = new Ext.Window({
title:'具体信息',
width:500,
height:500,
items:[grid1],
closeAction:'hide'
});
});