I have a SQLDataSource that needs some extra parameters passed to it for all operations. I'm loading records from the datasource into a ListGrid for editing. On the fetch I'm manually adding the parameters using DSRequest.setParams() and using the version of fetchData() that takes a customized DSRequest object. My question is, how to I customize the DSRequest that is generated automatically by the ListGrid when a row is updated or added?
Announcement
Collapse
No announcement yet.
X
-
It isn't enough that I know which grid sent the request. I need to pass a variable bit of data from the client. I've tried calling DataSource.setDefaultParams() on the datasource the grid is bound to. That seems like it is exactly what I need. But the DSRequest I receive doesn't have the params.Last edited by jay.l.fisher; 5 Jul 2010, 15:23.
Comment
-
The data I need to pass is not something unique to each row. It really is a datasource level variable that gets referred to in Velocity template in the ds.xml. The server needs it on every DSRequest for that datasource, not at the row level. That sounds like what setDefaultParams() is for, correct?
I was hoping for some way to customize the DSRequests that a particular ListGrid generates, but if that isn't possible, a way to customize all DSRequests for the datasource will do. I've tried setDefaultParams on the data source, but no params are getting passed on the DSRequests. Is there more to it that simply calling DataSource.setDefaultParams(map)?Last edited by jay.l.fisher; 6 Jul 2010, 13:16.
Comment
-
I've tried adding setDefaultParams() in a couple of different places and don't see the params showing up on the request in any of them. Here is a relatively simple one.
Code:DataSource ipMrVenDS = DataSource.get("IPMRVEN"); myVendorGrid = new ListGrid(); myVendorGrid.setHeight100(); myVendorGrid.setWidth100(); myVendorGrid.setDataSource(ipMrVenDS); Map extras = new HashMap(); extras.put("MyParameter", "Where are you?"); ipMrVenDS.setDefaultParams(extras); myVendorGrid.setFields(new ListGridField("VVEN"), new ListGridField("VNAM")); myVendorGrid.setShowFilterEditor(true); myVendorGrid.setAutoFetchData(false);
Code:{ "actionURL":"http://127.0.0.1:8888/ipgui/sc/IDACall", "showPrompt":true, "prompt":"Finding Records that match your criteria...", "transport":"xmlHttpRequest", "promptStyle":"dialog", "bypassCache":true, "data":{ "criteria":{ }, "operationConfig":{ "dataSource":"IPMRVEN", "repo":null, "operationType":"fetch", "textMatchStyle":"substring" }, "startRow":0, "endRow":75, "componentId":"isc_IpListGrid_13", "appID":"builtinApplication", "operation":"IPMRVEN_fetch", "oldValues":{ } } }
Comment
-
I realized that right after asking the question. But I still don't see them anywhere. In the Velocity code I'm using $httpParameters.FileGroupSuffix to reference the param I'm setting with setDefaultParams() and it is empty.
I'll try changing it to $servletRequest.getParameter("FileGroupSuffix"). Is that the right format? Or do I not need the quotes?
Comment
Comment