PDA

View Full Version : Grid filters and row exchange between grids



chkamran
25 Sep 2012, 5:43 AM
Hi,
I am new to Extjs. I am trying to create two grids where I can move items back and forth using buttons. My data is coming from a php file where I query database tables and use json_encode. So far, I was able to create one grid with data coming from the php file (same domain).

I also need to have filters for the data in the left grid. I have tried creating them where I pass the filter value as param in datastore.load(...). I am thinking that I am doing this the wrong way. There must be a better way to do this.

Please point me in the right direction.

advance thanks.

scottmartin
25 Sep 2012, 6:32 AM
Are you copying records, or moving? The idea here is to have a store for each grid and send the required record to the other store and remove from the existing.

You can also filter:
http://jsfiddle.net/5gRJW/
http://jsfiddle.net/wC9Dr/

Scott.

chkamran
25 Sep 2012, 7:05 AM
Hi Scott,

I want to able to move rows back and forth.
As for the filters, does the datastore have the fetched data locally for the filters or do I have to query the database each time? I will look into the links you have provided.

Please excuse my lack of knowledge.

thanks,
Kamran.

scottmartin
25 Sep 2012, 7:11 AM
I want to able to move rows back and forth.

Have you looked at our DnD examples?
http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/dd/dnd_grid_to_grid.html

Scott.

chkamran
25 Sep 2012, 7:32 AM
Yes, I did. I would like to move the selected rows using a button and not by dragging.

thanks,
Kamran.

scottmartin
25 Sep 2012, 2:14 PM
Do you mean something like this?
http://jsfiddle.net/EgQYJ/

Scott.

chkamran
25 Sep 2012, 3:18 PM
Simply awesome Scott! I've learned a lot from the examples you have provided. I will try it with remote data and let you know.

many many thanks,
Kamran.

Note: my data is coming from a local php file that queries a db table.

chkamran
26 Sep 2012, 11:07 AM
Hi,

I don't quite understand the difference between local and remote data. Is that for filtering only? Can I populate my store one time initially and put filter and manipulate locally?

thanks,
Kamran.

scottmartin
26 Sep 2012, 2:34 PM
Local data would be like an array store, where remote would be from a DB. In most cases, you would filter the data at the server level when using remote as you only want to send the data you want.

Scott.

chkamran
27 Sep 2012, 5:16 AM
Many thanks ! =D>