|
Query |
Response | |||
|
How to capture the values changed in the cell edit method so that I can update them into the DB? |
You can use the “CellEdit” event, to get the cell information and also call the server side method through AJAX on the same event (“CellEdit”). Please refer the code snippet below.
Code Snippet: [ASPX]
Code Snippet: [JavaScript]
Code Snippet: [C#]
| |||
|
The value of the assigned field is always 1 or zero, can we have a field template to replace it by a checkbox which is checked or unchecked depending on the assigned value (checked when value is 1 and uncheked when value is 0) |
You show the check boxes (checked when value is 1 and uncheked when value is 0) by using the “renderSuccess” event. Please refer the code snippet below.
Code Snippet: [ASPX]
CodeSnippet: [JavaScript]
Note: We have achieved your requirement as an work around solution and we are facing the following issues. Also, please confirm us whether this requirement satisfied. Hence, we will check on this further.
Known issues: 1) While hover cells which contain checkboxes, script error thrown (Meanwhile, we have disabled the EnableToolTip API).
2) While check (or) uncheck the checkboxes, script error thrown.
| |||
|
Lastly, would be great if it is batch editable, so instead of calling the method everytime when cell is edited; can we edit all cells and then save them with a button click? |
You can maintain the cell values in an array through the “CellEdit” event. And, you can pass the values from client side to server side through AJAX method on button click.
Code Snippet: [ASPX]
Code Snippet: [JavaScript]
Code Snippet: [C#]
|
|
public Dictionary<string, object> LoadGridData(Dictionary<string, object> Test)
{
String rowHeader, columnHeader;
dynamic data = serializer.Deserialize<dynamic>(Test["Test"].ToString());
foreach (KeyValuePair<string, object> i in data["editCellsInfo"])
{
if(i.Key == "rowHeader")
rowHeader = ((object[])i.Value)[0].ToString();
else if(i.Key == "columnHeader")
columnHeader = ((object[])i.Value)[0].ToString();
}
return dict;
}
|