Updating data model question
Below is a template i wrote to allow only numeric input
When I used this template with a javascript array as the data model everything worked fine
However when used with xml I am unable to update the table model the error is on the line marked (1)
I am not very proficient with java script and any help is greatly appreciated.
Thank you
When I used this template with a javascript array as the data model everything worked fine
However when used with xml I am unable to update the table model the error is on the line marked (1)
I am not very proficient with java script and any help is greatly appreciated.
Thank you
if (!window.Prima) Prima=[];
if (!Prima.Templates) Prima.Templates=[];
Prima.Templates.NumberInput = Active.Templates.Text.subclass();
Prima.Templates.NumberInput.create = function()
{
var obj = this.prototype;
// editor is not part of the template,
// there is only one single instance of editor object.
var editor = new Active.HTML.INPUT;
editor.setClass("templates", "input");
editor.setAttribute("type", "text");
editor.setAttribute("value", function()
{
return template.getItemProperty("text");
});
// template variable provides temporary reference
// to the parent template during edit mode.
var template;
function switchToEditMode()
{
template = this;
template.element().style.padding = 0;
template.element().innerHTML = editor;
editor.element().focus();
}
obj.setEvent("ondblclick", switchToEditMode);
function switchToTextMode()
{
var value = editor.element().value;
var intVal = value * 1;
if(!isNaN(intVal))
{
//alert(intVal);
template.setItemProperty("text", value); ---- (1)
}
template.refresh();
template = null;
}
editor.setEvent("onblur", switchToTextMode);
};
Prima.Templates.NumberInput.create();
Bhaskar
July 23,