PDA

View Full Version : retriving subdata from the existing record data



sravan reddy
18 Aug 2009, 10:54 AM
HI ,

I want to retrieve sub data by selecting the particular row in other data source record in the same form. Could you please give me the solution for this.

Regards,
Sravan

pdegit
18 Aug 2009, 10:57 AM
Could you please explain a bit more what you're trying to do?

sravan reddy
18 Aug 2009, 11:07 AM
I am displaying the data in one section by reading xml which is fteching from mysql database.
when I want select the particular record from that data .
I need to display the data which is related to the above record.

for example.

I am displaying first data like this. which is fetching from mysql and displaying it
empid name
1 sravan
2 reddy


I have another table in mysql like this

empid locatiion
1 pune
2 hyb

Now if I select any row from the first data (for example if i select first row (1,sravan) then next section it should display (1,pune).

pdegit
18 Aug 2009, 11:15 AM
What you need to do is apply a filter to the store containing the locations, based on the selected record in the first store. Are all locations loaded already, or are you loading them upon selecting an employer?

sravan reddy
18 Aug 2009, 11:19 AM
well I have two grids and then a form in one panel..so grid1 is loaded on page load...so when I select a record in grid 1....it needs to pass an id to my script which then access mysql table and based on passed id....loads grid 2.....and if I click on a record on grid2 which then needs to populate the form ....I've figured out how to populate the form....but not when I click on grid 1...populating the grid 2

J@y
18 Aug 2009, 12:19 PM
its can be done easily, look at http://extjs.com/deploy/dev/docs/output/Ext.grid.GridPanel.html


see the "getSelectionModel()"

and then http://extjs.com/deploy/dev/docs/output/Ext.grid.RowSelectionModel.html

see the "getSelected()"



You will find that the return type is "records"
so you can get the data by the fields: records[i].data.yourfieldname.



Finally what you need to do is to put the 2nd grid's store.load() command into the 1st grid selectionModel's rowselect event.

sravan reddy
19 Aug 2009, 10:15 AM
can you please give brief explanation to that. It will be very helpful to me

sravan reddy
20 Aug 2009, 12:52 PM
bump...anyone?????

carol.ext
20 Aug 2009, 12:57 PM
What question do you have about what was suggested?

sravan reddy
20 Aug 2009, 1:14 PM
I don't understand how to implement it...:(