ExtGridPanel에 대해 어떻게 데이터 원본을 교체할 수 있습니까?

7886 단어 jspext
내가 페이지의 어떤 단추를 눌렀을 때 방법을 호출했다
이 방법에서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
    });

스토어의 리로드 방법인가요?
//////////////////////////////
모든 코드는 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'
	});
	
});

좋은 웹페이지 즐겨찾기