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.
Unfortunately, activation email could not send to your email. Please try again.

How do I know how to use the Grid functionality?

Thread ID:

Created:

Updated:

Platform:

Replies:

119443 Jun 21,2015 10:32 PM Aug 28,2017 08:10 AM JavaScript 3
loading
Tags: ejGrid
Mohamed Zuraiman
Asked On June 21, 2015 10:32 PM

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


Madhu Sudhanan P [Syncfusion]
Replied On June 22, 2015 06:17 AM

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

Albu Andi Gabriel
Replied On August 24, 2017 05:03 AM

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


Thavasianand Sankaranarayanan [Syncfusion]
Replied On August 28, 2017 08:10 AM

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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;