PDA

View Full Version : assigning ds to form and submiting



nmohan.025
14 Sep 2010, 2:34 AM
How to assign ds to form, so that it will submit through data store's url...

Condor
14 Sep 2010, 2:39 AM
A form has it's own load and submit handling. It doesn't use a store.

nmohan.025
14 Sep 2010, 2:50 AM
ok...

ds.baseParams=Ext.getCmp('simple_search').getForm().getValues();
Ext.getCmp('simple_search').getForm().submit({
params:{limit:10},
success:function(form,action)
{
ds.loadData(action.result);
}});

Here i don't want to set baseparams and params, but without baseparams paging is not working..i need to to set baseparams and params only in datastore...
If you have any solution help me...

Condor
14 Sep 2010, 3:28 AM
OK, so you want to use the form as a filter for a store. That is something completely different!

In that case you shouldn't submit the form, but load the store with the parameters as baseParams, e.g.

ds.baseParams = Ext.getCmp('simple_search').getForm().getValues();
ds.load({params: {start: 0, limit: 10}});

nmohan.025
14 Sep 2010, 3:49 AM
i can load ds with params but i have to do it with form submission only....

Condor
14 Sep 2010, 5:11 AM
i can load ds with params but i have to do it with form submission only....

Why? Do you also have custom error checking?

In that case you could use:

Ext.getCmp('simple_search').getForm().submit({
...
params: {start: 0, limit: 10},
success: function(form, action){
// added to support paging
ds.baseParams = Ext.getCmp('simple_search').getForm().getValues();
ds.lastOptions = {params: {start: 0, limit: 10}};
ds.loadData(action.result);
}
});