We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How do I know how to use the Grid functionality?

Dear Support,


Do you have any documentation on how to use the ejGrid functionalities?

1) How to bind the data from a database using PHP?

2) How to know which rows in the ejGrid have been changed, so that I could update only those changed rows back to the database using PHP when the [Save] button is clicked?


Thank you very much.


Regards,

Zuraiman


4 Replies

MS Madhu Sudhanan P Syncfusion Team June 22, 2015 10:17 AM UTC

Hi Zuraiman

Thanks for using Syncfusion products.

Query #1: “Do you have any documentation on how to use the ejGrid functionalities and How to bind the data from a database using PHP?”

Already we have a blog content that discussed about using ejGrid in PHP, please refer the below link.

https://www.syncfusion.com/blogs/post/Grid-Control-for-JavaScript-in-PHP.aspx

In the above link, we have used ejDataManager to populate grid with data from PHP service. Please refer the below code snippet.


var data = ej.DataManager({

                url:"http://localhost/phpservice/server.php/?action=get_Data",

                insertUrl:"http://localhost/phpservice/server.php/?action=insert_Data",                          

                removeUrl:"http://localhost/phpservice/server.php/?action=delrec",

                updateUrl:"http://localhost/phpservice/server.php/?action=update_Data",

                adaptor: new ej.UrlAdaptor()

            });

               

            $("#Grid").ejGrid({

                dataSource: data,

                 . . . .  .
                });


For your convenience we have created a simple PHP sample in which grid is populated data from MySql and the same can be downloaded from the below location.

Sample Location:  http://www.syncfusion.com/downloads/support/forum/119443/ze/phpservice173652455

Query #2: “How to know which rows in the ejGrid have been changed, so that I could update only those changed rows back to the database using PHP when the [Save] button is clicked?”

We can perform the CRUD operation in grid using editSettings property of the grid. Please refer the below code snippets.


var data = ej.DataManager({

                url: "http://localhost/phpservice/server.php/?action=get_Data",

                insertUrl: "http://localhost/phpservice/server.php/?action=insert_Data",

                removeUrl: "http://localhost/phpservice/server.php/?action=delrec",

                updateUrl: "http://localhost/phpservice/server.php/?action=update_Data",

                adaptor: new ej.UrlAdaptor()

            });


            $("#Grid").ejGrid({

              . . . . . .

                editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },

                toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },


            });


In the above, the insertUrl, removeUrl and updateUrl properties of the ejDataManager defines the PHP service method to be called on corresponding CRUD operation. If we misunderstood your requirement, could you please provide us following information regarding this requirement?

1. You have mentioned as “which rows in the ejGrid have been changed” in the query, are you expecting to perform the batch editing in grid?, please refer our online batch editing demo from the below link.

     http://js.syncfusion.com/demos/web/#!/azure/grid/Editing/BatchEditing

2. And also could you please tell us whether you are expecting to perform the save operation on external button click?

Please refer the below help link for more details on using grid features.

http://help.syncfusion.com/ug/js/index.html#!Documents/conceptsandfeatures22.htm

http://help.syncfusion.com/ug/js/index.html#!Documents/databinding8.htm

http://help.syncfusion.com/ug/js/index.html#!Documents/editing2.htm

http://www.syncfusion.com/kb/javascript/ejgrid

Please let us know if you have any queries.

Regards,
Madhu Sudhanan. P


AA Albu Andi Gabriel August 24, 2017 09:03 AM UTC

Hi,

I just try the sample and I have a problem showing the data into the grid.

If I go direct on the link : http://192.168.1.3/phpservice/server.php?action=get_Data , I can see all the data from the database. But on the http://192.168.1.3/phpservice/index.php ... is only the waitingpopup.gif and empty grid. Will never load and the script doesn't have any errors in the browser.

Thanks,

Andy



TS Thavasianand Sankaranarayanan Syncfusion Team August 28, 2017 12:10 PM UTC

Hi Andy, 
 
Sorry for the inconvenience caused. 
 
Before proceeding to your query please provide the following details. 
 
  1. Share screen shot or video demonstration of the issue.
  2. Share full grid code example both server and client side code.
  3. Essential studio version.
  4. If possible share the sample or reproduce the issue in the previously attached sample.
 
Regards, 
Thavasianand S. 



MI mistakiesh July 12, 2021 03:51 PM UTC

A fine thread for opening the details of PHP Database! 
After studying from the following resource php redis extension. I was in a need to cover for a database and PHP as Redis is also one ideal message broker and a 

memory caching system


Loader.
Live Chat Icon For mobile
Up arrow icon