According to the user guide for
grid_customcolumn_beginedit Event Handler
Return Value
false if you wish to cancel entering edit mode. To continue entering edit mode, do not return any value.
I modified the sample app's Custom Column demo.ascx to contain the following:
Code: HTML/ASPX
<eo:CustomColumn Width="200" HeaderText="Question"
ClientSideEndEdit="on_question_end_edit"
ClientSideGetText="on_question_column_gettext"
ClientSideBeginEdit="on_question_begin_edit"
>
<EditorTemplate>
<input type="text" id="question_TextBox" />
</EditorTemplate>
</eo:CustomColumn>
and added the following JavaScript to the file:
Code: JavaScript
function on_question_column_gettext(column, item, cellValue)
{
return cellValue;
}
function on_question_begin_edit(cell)
{
//Get the current cell value
var v = cell.getValue();
// keep Q2 readonly
if (v.substr(0, 3)== 'Q2.')
{
return false;
}
//Load the value into our text box
var textBox = document.getElementById("question_TextBox");
textBox.value = v;
}
function on_question_end_edit(cell)
{
//Get the new value from the text box
var textBox = document.getElementById("question_TextBox");
var v = textBox.value;
//Return the new value to the grid
return v;
}
Two problems have occurred:
1) When I click on Q2, it returns false. That's good. When I click off Q2, the value of that cell becomes 'null'. Therein lies the problem
2) The textbox's size does not correspond at all to the cell width. It appears that I cannot get the cell width, otherwise I would manually set it in the begin_edit routine. I can manually set it in the template, but it seems odd, as the existing code doesn't have to set the select's width.
Thoughts?