-
22 Oct 2011 8:29 AM #1
Dynamic Store Configuration
Dynamic Store Configuration
I'm new to Ext Designer and have a question on how to dynamically create the proxy / store URL for loading data from the server.
For example, let's say I want to load a list of orders for a particular customer using a Store. The server-side URL that handles order may be "userOrders.php". One of the arguments the server expects is the customer-id, so that the server will select only the orders for a particular customer.
How would I do this in Ext Designer? How do I pass dynamic arguments to the URL field for a proxy / store?
Thanks!
-
24 Oct 2011 7:37 AM #2
The only recomendation I can give to you is dont use Designer's stores, write it by hand and instantiate in the initComponent() method.
Designer's support for models and stores is weak to my point of view.
Regards.UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!
-
26 Oct 2011 9:47 AM #3
Assuming you know about the.js file generated that you edit to add your event handlers, the below code is what worked for me to call the relative url to a .p (similar to a .php) with parameters.
onBtnGroupClick: function() {
try{
var strSearch = Ext.getCmp("txtGroup").getValue();
if (strSearch == "") {
alert("You must enter a group to search for.");
return;
}
var cs = Ext.StoreMgr.get("CustStore");
var myProxy = cs.getProxy();
myProxy.url = "/scripts/codexdv1.wsc/JSONFindCustomer.p?Mode=GroupName&FilterValue=" + strSearch;
cs.load();
}
catch(err){
alert("Error in BtnGroupClick: \n\n" + err.description);
}
}


Reply With Quote