PDA

View Full Version : Submitting form from a grid button



Niugeo
14 Dec 2010, 8:31 AM
Hi all,
I've got a grid with 3 buttons on the last column.
I would like to create a "submit-button". In other words I would like that the user, in front of the grid, should be able to click in one of the 3 buttons to each rows, and this will open a new window at, lets call it, newWindow.php.
This page, by POST method receive two parameters from my grid, and these two parameters are exactly the 3th and 4th column values corresponding to the rows of the button.

One example is better that 1000 words
I would like to click on the button in blue, and a new window will be opened at newWindow.php and POST method will send the two values '12' and '45.8350866'.
23819
Any ideas??

thank you all!

Ballsacian1
14 Dec 2010, 8:47 AM
http://rowactions.extjs.eu/
Using row actions to capture the clicks and then using Ext.Ajax to make the POST to your URL with the values required and on return populate a new window with the data returned from the AJAX call.

Niugeo
14 Dec 2010, 9:03 AM
Thank you Nallsacian, the example you posted almost looks like what I need, however I'm not so skilful with ExtJs and rowactions, isn't a way to use my existing code changing the alert message from the columns definition in my GridPanel with the submiting operation I need?



.
.
.
.

{
xtype: 'actioncolumn',
width : 80,
items: [{
icon : '../shared/icons/fam/Lettera D.png', // Use a URL in the icon config
tooltip: 'Vista ultimo giorno',
handler: function(grid, rowIndex, colIndex) {
var rec = store.getAt(rowIndex);
alert(" bottone per la vista giornaliera");
.
.
.
.

Should I simply insert the Ajax inside the handler?I think that is the part of the code where I've to manage the click of the user, right?

Ballsacian1
14 Dec 2010, 9:28 AM
Yes I'd put the Ajax inside of that handler.

Niugeo
15 Dec 2010, 3:40 AM
Ok, today I started to manage data from my grid, but I found some difficulties to send the values I've take from the grid to my newWindow.php file.

Here is my code


.
.
.
.
handler: function(grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex);
var fieldName = grid.getColumnModel().getDataIndex(columnIndex);
var VP = record.get('Vp');
var Intervallo = "month";
Ext.Ajax.request({
url:'newWindow.php',
params: params,
method:'POST',
??????
})
}
.
.
.
.

While the first two lines of newWindow.php are


$Vp=$_POST['VP'];
$Intervallo=$_POST['Intervallo'];
.
.
.
.

I don't know where I've to put my two values, I can't find any tutorials.
I would like that newWindow.php will be opened in a new card of my browser, but I didn't fine any example of this.
How can I proceed?

Niugeo
17 Dec 2010, 11:17 AM
[ALMOST-SOLVED]:
ok, I've sent correctly parameters to newWindow.php but still I can't render this script on a new window but just on a messageBox...
Any ideas?