|
steven
|
 |
« on: July 21, 2008, 02:59:38 AM » |
|
In tutorial 2, we have talked about how to retrieve data from server/database and display them page by page. It seems to be insteresting. You don't think so? All right, let me let it be this time.  Let's go over some knowledges about stuff transfered between grid and server. Do you still memeber paging process : When a paging button(first, previous, next and last) is pressed, sigma grid will send paging relevant info to server. So does saving data. When save button pressed, sigma grid will send deleted, appended and updated rows to server. The data structure looks like As you can see, those deleted, appended and updated rows are right there.
|
|
|
|
« Last Edit: October 23, 2008, 02:37:42 AM by steven »
|
Logged
|
Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
|
|
|
|
steven
|
 |
« Reply #1 on: August 04, 2008, 01:36:20 AM » |
|
Do you remember how to convert these pretty string into php object? Right, we have a very powerful function named json_decode from PHP5.20. If you are using older version, you may need a third-party library, for example, Zend JSON at http://framework.zend.com/manual/en/zend.json.html. As we know, all the posted info is stored by post variable named _gt_json. The following two lines help us get the deleted records. Here $deletedRecords is array of array/hash(JSON object), which depends on what format you feed grid with. Take hash for example, you can get all the order numbers of deleted rows with following lines.
|
|
|
|
« Last Edit: November 28, 2008, 05:08:44 AM by steven »
|
Logged
|
Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
|
|
|
|
steven
|
 |
« Reply #2 on: August 04, 2008, 01:47:05 AM » |
|
The thing left is to operate database with PHP API. To be more professional, I recomend you using a PHP framework, such as CakePHP, to make your application safe and stable. But in this tutorial, I still write bare sql to achieve it. Here are the whole code to delete rows.
It's really easy, isn't?
|
|
|
|
« Last Edit: November 28, 2008, 05:09:24 AM by steven »
|
Logged
|
Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
|
|
|
|
steven
|
 |
« Reply #3 on: August 04, 2008, 02:11:57 AM » |
|
By far, we have two php files, one for loading by page(see tutorial2), the other for deleting. The last but not least thing we need to do is to make saveUrl of grid point to the php file.
In fact, we could merge those two ones into a single file. But how can we determine whether grid is ask for data or posting data for saving? Ah, good question. We have a field reserved for this. See the definition of _gt_json and you will see first field is action. It could be load or save.
|
|
|
|
« Last Edit: November 28, 2008, 05:10:15 AM by steven »
|
Logged
|
Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
|
|
|
cpb.sos
Newbie

Posts: 1
|
 |
« Reply #4 on: December 26, 2008, 02:37:10 PM » |
|
Please.
I need a php structure sample to save data grid.
Thanks
|
|
|
|
|
Logged
|
|
|
|
|
steven
|
 |
« Reply #5 on: December 26, 2008, 05:12:03 PM » |
|
|
|
|
|
|
Logged
|
Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
|
|
|
|
Darshan
|
 |
« Reply #6 on: December 31, 2008, 03:33:57 AM » |
|
???I faced one problem here.. If i have 3-4 editable columns and when i edit one column and immediately i change other at that time it cant save the first column and directly goes to change for second column.. So, what i can do here to solve this? Thanks in advance.......... 
|
|
|
|
|
Logged
|
|
|
|
|