View Full Version : Grid as Form Field

19 Mar 2009, 2:49 AM
Hi all,

i need some hints how to pu t a grid into a form panel, which is filled with the xmldata loaded by the form. how can i add the grid content to the values of the form on submit?

the idea is to drag items from a tree into the grid and submit the "chosen" items...

i am getting nearly mad, i did not yet found any advice on the web how to connect data storage and grid with the form...

another problem is that form fields, which are defined after the grid element are not rendered and the panel looks weird finally....

any suggestions?

19 Mar 2009, 3:00 AM
As to layout, you can see http://examples.extjs.eu/?ex=treeinform, just replace tree with grid. Additionally, you need to supply getValue function for the grid.

19 Mar 2009, 3:49 AM
It is quite easy to add a tree into a form, but how can i add a grid into my form which is filled with data which comes from the xml the form loads?

my xml content looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<ajax success="1">
<create_date>2009-03-12 11:23:55</create_date>
<unqualified_path>/Film/Camera Equipment/Camcorder</unqualified_path>
<unqualified_path>/Film/Camera Equipment/System Cameras</unqualified_path>
</category> </categories>
(could have been formatted a bit better, i know)

I want to have a row in the grid for each <category>... it is quite difficult for me to understand how to add the data to the storage...

25 Mar 2009, 1:57 AM
no one who might help?

25 Mar 2009, 2:32 AM
Loading the grid with xml data and placing it to a form are two different tasks. The best source of info on loading is http://extjs.com/deploy/dev/examples/grid/edit-grid.html and http://extjs.com/learn/Ext_FAQ_Grid.

For having the grid in a form you need to write setValue and getValue functions.

Grid in form is pretty much similar to Combo in form.

26 Mar 2009, 7:56 AM
Had the same Problem (injecting Grid as Form-Field).
Based on Saki's Example i defined my Grid with the following Options and now it works perfectly:

fieldLabel: 'Angebote',
isFormField: true,

getName: function()
return 'existingOffers';

dataIndex: 'existingOffers',

getValue: function()
return true;

setValue: function(v)