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

Update multiple rows at a time

Hi,
I just started using Syncfusion. By far, I'm practicing with the default samples in which update button is enabled when I click on 1 row and disabled after I'm done editing in that row. So my questions are:
1. How can I keep the Update button enabled so I can edit multiple rows and it's only disabled when I actually click it?
2. What is the code to refresh the grid because I might need to use it in jquery at some points.
Thanks

5 Replies

MI minh April 10, 2015 01:12 AM UTC

Just one addition to my question above, how can I attach an Action method to the Delete or Update button so the Action method would be invoked accordingly? I'm thinking of calling Ajax but I think there would be a faster way...


PK Prasanna Kumar Viswanathan Syncfusion Team April 10, 2015 12:37 PM UTC

Hi Minh,

Thanks for using Syncfusion Products.

Query 1 : “How can I keep the Update button enabled so I can edit multiple rows and it's only disabled when I actually click it?”

We suggest you to use batchEditing feature for the above query. In batch editing we can able to edit multiple rows and we can update all the edited records at one time.

Please refer the below online sample for batch editing feature:

Link : http://mvc.syncfusion.com/demos/web/grid/batchediting

For your convenience we have created a sample and sample can be downloaded from the below link

Query 2 : “What is the code to refresh the grid because I might need to use it in jquery at some points”

To refresh the grid, we suggest you to use refreshContent method in ejGrid.

We have already created a UG documentation for the refreshContent api. So, please refer the below link

Link : http://help.syncfusion.com/UG/JS_CR/ejGrid.html#refreshContent

Query 3 : “how can I attach an Action method to the Delete or Update button”

For this query, we suggest you to use URL Adaptor or remoteSave Adaptor. We can map CRUD operation inGridto Server-Side Controller action using the properties “InsertURL”, “UpdateURL” and “RemoveURL. In the below attached sample, we use batchediting with URL Adaptor and for batchediting with URL Adaptor and for batcheditingwe map CRUD operation using the property Batch URL.

Please find the below code snippet :

@(Html.EJ().Grid<MvcApplication14.OrdersView>("FlatGrid")

.Datasource(ds => ds.URL("BatchDataSource").BatchURL("BatchUpdate").Adaptor(AdaptorType.UrlAdaptor))

.AllowPaging() /*Paging Enabled*/

.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Batch); })

.ToolbarSettings(toolbar =>

{

toolbar.ShowToolbar().ToolbarItems(items =>

{

items.AddTool(ToolBarItems.Add);

items.AddTool(ToolBarItems.Edit);

items.AddTool(ToolBarItems.Delete);

items.AddTool(ToolBarItems.Update);

items.AddTool(ToolBarItems.Cancel);

});

})

.Columns(col =>

{

col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();

col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();

col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(75).Add();

col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();

col.Field("OrderDate").HeaderText("Order Date").TextAlign(TextAlign.Right).Width(80).Format("{0:MM/dd/yyyy}").Add();

col.Field("ShipCity").HeaderText("Ship City").Width(110).Add();

}))

We have already created a UG documentation for the URL Adaptor and remoteSave Adaptor. Please refer the below link for the UG documentation

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

Sample Link : http://www.syncfusion.com/downloads/support/forum/118796/Sample-1432307345.zip

Please get back to us if you have any further assistance on this,

Regards,

Prasanna Kumar N.S.V



MI minh April 10, 2015 04:19 PM UTC

Hi,
Thanks for your reply. I think your link in query 2 for refreshing content is not working. Can you please refer me to other one?


MI minh April 10, 2015 04:23 PM UTC

And also the link in query 3 for crud operation with server side is not working too. Can you please fix that?              


PK Prasanna Kumar Viswanathan Syncfusion Team April 13, 2015 02:26 PM UTC

Hi Minh,

Sorry for the inconvenience caused.

Please refer the below link for UG documentation link:

Link : http://help.syncfusion.com/cr/js

Please follow the steps for the refreshContent Api:

Steps : ejGrid -> Methods -> refreshContent

Please refer the below link for UG documentation of URL Adaptor and remoteSave Adaptor

Link : http://help.syncfusion.com/web

Please follow the steps for the documentation

Steps : Grid -> Concepts and Features -> Editing -> CRUD Operation With Server-Side

Please get back to us if you have any further assistance on this,

Regards,

Prasanna Kumar N.S.V


Loader.
Live Chat Icon For mobile
Up arrow icon