PDA

View Full Version : Clickable Grid with hyperlink



Asadjan
20 Jun 2010, 10:27 AM
Hello everyone, I have been reading everywhere but could not find the right answer. I would like to put a grid of 4 columns i.e. ID, Organization Name, Employee Name and 'View Details'. THe View Details should be clickable or the whole row could be clickable. When the user click on the row or the 4 entry then the details of the Employee should be displayed on the same inde.php page.

I could use the grid with clicks and have onClick function behind the row...I know that much but then can't figure out how run another sql to bring the Employee's details form the server and then display on the same page under the grid without reloading the page...

I really need that urgent and any help would be very much appreciated.

Thanks mill,

Asad

yagi
20 Jun 2010, 8:15 PM
Hi Asadjan.., I have the same problem as you got.. I can't yet solve it.
But based on your statement, you want to get record value in the selected grid. You can use rowActions plugin and copy() function to do that. it will get all record values in a grid you select and you can parse it into the next window.

here is my snippet code :


'icon-copy2': function(grid,record,action,row,col)
{
var rec = record.copy(); // copy record
config.actionButtons.form.getForm().loadRecord(rec);
}


Hope it will help you.

In this case, I'm using rowActions to get all record values but I haven't been able to open new page.

Asadjan
20 Jun 2010, 10:36 PM
Hi Yagi,

Thanks for your reply, Actually I don't want to open a new page but want to open a new Grid on the same page at the bottom and pull the data from Employee table after clicking on the row in the first grid where the employee Id is in the hyperlink.

I hope to get some clear answer/help on this.

Condor
20 Jun 2010, 11:46 PM
Does the grid store already contain all the information or do you need to make another request (the store can contain a lot more fields than are visible in the grid)?

An additional request would require another .php page that returns extra data (in JSON, so NO HTML markup!) for a specific id. You can use this .php page to load your form from.

Asadjan
21 Jun 2010, 2:02 AM
Actually what I am trying to do is, when the grid is loaded successfully then I will click on a row or cell and then it will display another grid of the employees under the original grid on the same page, which has all the employees details and these details should be displayed in the normal html table like <table> <tr> stuff, because i have to use a lot of colspan and rowspan.

I am thinking to call the php function and display for me the html part of it, I mean the html table with all the employee details. I don't know how to call the php from ExtJS????

Any help would be very much appreciated

Condor
21 Jun 2010, 2:31 AM
You could use:

panel.body.load({
url: 'details.php',
params: {
id: idOfRecord
}
});

ps. You could also load pure JSON and use an XTemplate to render the data (in that case your .php doesn't need to know anything about markup).