PDA

View Full Version : Possible? Using grid inside formpanel



prodigy7
9 Sep 2009, 5:16 AM
Hi,

i'm looking for a solution, how I can display list which can be reordered with drag and drop and where items can added, edited and deleted. So i decide, that the best solution is, using an editorgrid with "Grid Drag & Drop Row Order" Plugin. Now, the problems I have:

a) When I submit values, only the first value are submitted. And for this value, the post name isn't how I set - it is ext-comp-....
What can I do, so that the whole list is submitted?

b) I can populate the form fields with
{
success: true,
data: {
name:"Mr. Test"
}
} but it doesn't work with the grid. What I've to do so that I send a list to the grid?

I uploaded a sample here: http://download.prodigy7.de/files/reports/extjs/3.0.0/formgrid/formgrid.html
Start it and look with firebug, what are submitted - or even not.

prodigy7

9 Sep 2009, 5:26 AM
yes it's possible. You're going to have to gather the grid's data when you do a submit and code for setValues,isValid,markInvalid, clearInvalid.

9 Sep 2009, 5:29 AM
to get the store's data:



var gridVals = [];

Ext.each(store.getRange(), function(record) {
gridVals.push(record.data);
});

prodigy7
9 Sep 2009, 5:59 AM
Ehm ... a little bit slowlier for novices ;-)

Your sample... I parse each item and push it into an array. Alternatively I could build a string with delimiter and assign this string to a hidden field which I'd declared.

The other thing: I want load the store in "default" manner ... means: I send this for example:
{
success: true,
data: {
name:"Mr. Test",
grid: [{
entry: 'A'
}, {
entry: 'B'
}]
}
}The grid have the name 'grid' - how I can assign this? Is it possible, writting an handler which is called? If yes, how would an example look?

prodigy7

prodigy7
9 Sep 2009, 11:46 PM
Question: Is it a bug or a feature, that the grid-panel can't get an "own" name but an ext-comp-... name? My for using the grid with form is:

a) Give the control a own name which can be recognized by the script which gets the data
b) Implements the possibility, submitting the whole grid data with the form
c) Populate the data in the grid via the form (basicform) load

Currently the problem is, that when the grid itself as main control is used, all is okay. But when it used as part of an form, it doesn't fit in this "situation".