How to edit a column when call onchange event of checkbox in the same row
Hello Guys
I'm trying to call the editor template method "switchToEditMode" when the user triggered the onchange event of the checkbox template on the same row, other column.
Please Alex, help me! Follow is my source code:
<script type="text/javascript">
var pat_edi = new Array(12,2);
if (!window.My) My=[];
if (!My.Templates) My.Templates=[];
My.Templates.Input = Active.Templates.Text.subclass();
My.Templates.Input.create = function()
{
var obj = this.prototype;
var editor = new Active.HTML.INPUT;
editor.setClass("templates", "input");
editor.setAttribute("type", "text");
editor.setAttribute("maxlength", "15");
editor.setAttribute("valant",0);
editor.setEvent("onkeydown", function(){return true;})
var template;
function switchToEditMode()
{
if (template) {
switchToTextMode()
}
template = this;
template.element().style.padding = 0;
template.element().innerHTML = editor;
editor.element().focus();
$('tag51').getAttribute('valant');
$('tag51').value = '';
x_grid.disable();
editando=true;
}
obj.setEvent("ondblclick", switchToEditMode);
function switchToTextMode()
{
var value = f_grid[10].dataToText(editor.element().value);
var value_= editor.element().value;
var originalVal = template.getItemProperty("text");
if(originalVal != value)
{
template.setItemProperty("text", value);
template.setItemProperty("value", value_);
x_grid.enable();
setTimeout("x_grid.element().focus();",2000);
}
template.refresh();
template = null;
}
editor.setEvent("onblur", switchToTextMode);
editor.setEvent("onkeydown", function(event)
{
key = event.keyCode;
if(key==13){$('tag51').blur(); return;}
if ((key >= 35 && key <= 40) || key == 46)
return true;
});
editor.setEvent("onkeyup", function(){mascara($('tag51'),'.',' ',pat_edi,true); });
};
My.Templates.Input.create();
if (!window.My) My=[];
if (!My.Templates) My.Templates=[];