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

After SetOptions Editable does not get hit

2 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 12 Jul 2019, 10:14 PM

MVC 5; .Net Core; Visual Studio 2017; Telerik 2019.2.514

I have a grid that uses SetOptions to load the users saved state.  I am using incell editing.  After using setOptions my events for Editable no longer get hit.  Is there something I have to set manually after this like with the command buttons?

--Below I reassign the btnEdit event to the command button

var options = JSON.parse(response.myOptions);
options.columns[0].command[0].click = btnEdit;
grid.setOptions(options);

 

--My cell from grid

columns.Bound(p => p.ClearedBy).Title(text: "Cleared by").Editable("ClearedByEditable").Lockable(true);

 

--My Editable Event

function ClearedByEditable(e) {

Alert("I am here");

return false;

}

2 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 15 Jul 2019, 01:11 PM

I got the solution from the link below.  The editable function had to be added back just like the click functions.

https://www.telerik.com/forums/custom-css-for-conditionally-editable-columns

 

0
Tsvetomir
Telerik team
answered on 16 Jul 2019, 11:33 AM
Hi Richard,

I am glad to hear that you have managed to resolve the case. And I would like to thank you for sharing the answer with the community. I will go ahead and share the exact lines from that forum post which are relevant to this case:

"JSON.stringify() cannot serialize function references (e.g. event handlers), so if stringification is used for the retrieved Grid state, all configuration fields, which represent function references, will be lost. You have two options to avoid this limitation: use a custom implementation to serialize JavaScript functions, or add the function references back to the deserialized configuration object before passing it to the setOptions method."


Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Tsvetomir
Telerik team
Share this question
or