This is a migrated thread and some comments may be shown as answers.

[Solved] Grid Batch Editing Hide Submit Changes

3 Answers 146 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nick
Top achievements
Rank 1
Nick asked on 20 Dec 2011, 02:57 PM
I'm trying to implement batch/inCell editing but it doesn't seem to work without adding the SubmitChanges command to the toolbar.
the grid is in a form with other input fields and I would like to submit the changes using a 'Save' button instead of the using the toolbar command.  How can this be done?

Thanks,
Nick

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 20 Dec 2011, 03:46 PM
Hello Nick,

To manually submit the changes made in the Grid when using Batch editing, you can use the submitChanges method from the client API. In your case, in the Save click handler get the client object of the Grid and executes the method above to submit the changes.

Best wishes,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Nick
Top achievements
Rank 1
answered on 20 Dec 2011, 03:56 PM
not quite.  removing the SubmitChanges command from the toolbar disables incell editing. I can hide the command button using html attributes, but the toolbar still shows.

also, i have a checkbox column

columns.Bound(o => o.Selected)

.ClientTemplate(

 

"<input disabled='disabled' type='checkbox' name='Selected' <#= Selected? \"checked='checked'\" : \"\" #> />")

.Title(

 

"Select").Width(75).HtmlAttributes(new { style = "text-align:center" });


o.Selected is a boolean.  When i submitchanges on the grid after selecting the checkbox, the updated items sent to the grid action do not have the Selected property set to true.  It is always false. What do I need to change?

how do i submit additional form values to the controller grid action? 

Thanks,
Nick
0
Petur Subev
Telerik team
answered on 21 Dec 2011, 02:34 PM
Hello Nick,

Up to your questions:

  •  You should not have any problems to make the Grid editable in batch editing when there is no toolbar command to submit the options.
  • The changes should be applied properly (if sure use the default editor template)
  • Additional values can be sent when you subscribe to the OnSubmitChanges client event and you add your data to the values property of the event argument. 
    e.g.
    function onSubmitChanges(e) {
                e.values.myVal= "hello";
    }

For your convenience I attached a sample project which implements all the logic above. I hope this helps.

All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
Nick
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Nick
Top achievements
Rank 1
Share this question
or