PDA

View Full Version : Grid with a preview panel... shall I use another Datastore?



laluigino
20 Sep 2007, 9:32 AM
Hi you all!

I'm working on a little project which has a layout very similar to the "Feed Viewer" in the "Layout Examples" of the documentation.

Basically, I have a grid with paging, remote sorting, with a dataStore and a JsonReader: below there's a contentPanel that I'd like to fill (on rowclick) with more detailed data than the ones shown on the grid.

In the "Feed Viewer" example the preview is a simple copy of the field "description" into the grid itself... but in this case I should add to the grid all the columns (hidden) that i want to show into the preview panel, so I would load more data (many row per pages) that I don't need.

The way I achieve this, instead, is to create a new dataStore (very similar to the grid's one), then load data, get the result and update the contentPanel: this happens for each click on any row, that does not sound very well to me...

Something tells me there's a simplier way.... any idea?

Thank you in advance!

Animal
20 Sep 2007, 11:50 AM
If you have an Ext.form.Form with the Fields going by the same names as the fields in the Record that backs the Grid, you can just load the Form from the selected record:



myForm.loadRecord(myGrid.getSelectionModel().getSelected());

laluigino
20 Sep 2007, 11:07 PM
Thank for your reply, Animal!

Ok, what you suggest means that I have to put into the grid's datastore all the fields that I need to show in the preview, am I right? Even if I don't want them be shown into the grid itself... I was trying to avoid such a thing :">

So excuse me for my bad English, may be I've not explained my question clearly in my previous post!

I'm looking for a load method like Ajax.request, but with the datastore's JsonReader simplicity... or something else similar...

Thanks again!

Animal
21 Sep 2007, 12:12 AM
Yes, the Record definition must define them all, store them all the the Store, but only define the ColumnModel to show the ones you want in the Grid.

Might be a little more data, but it makes previewing so much easier. Just load the Form from the selected Record.

It's how you would do it in a local app...

laluigino
21 Sep 2007, 2:03 AM
Right, I see.... and I agree with you that that's the best solution!!

Afterall, the more data loaded are not so much, and the code gets very easier!

Thank you again!!

zanfe
16 Oct 2007, 5:30 AM
Hi all,
i'm new in this forum and i write english not very well (sorry :">).

In a panel i have a grid with data from XmlReader and i want, with the click row, recover data from another XmlReader and print in another panel a field (for example: <description>) of the XmlReader result.

Help me please.

Thanks
Z