:: Forum >> Version 1 >>

Textbox template (edit on double click)

The released grid version (1.0) is read-only. I am planning to add data editing in version 2.0 (end of 2004). However here is quick and dirty example how one can implement data editing in the current grid widget.

if (!window.MyMy=[];
if (!
My.TemplatesMy.Templates=[];

My.Templates.Input Active.Templates.Text.subclass();

My.Templates.Input.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(){
        if (
template) {
            
switchToTextMode()
        }
        
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;
        
template.setItemProperty("text"value);
        
template.refresh();
        
template null;
    }

    
editor.setEvent("onblur"switchToTextMode);
};

My.Templates.Input.create();
 
Additional CSS rules:
.active-templates-input {
            
overflowhidden;
            
width100%;
            
height100%;
            
padding0px 5px;
            
margin: -1px 0px;
            
border1px solid #666;
            
vertical-alignmiddle;
            
fontmenu;
            
line-height1.4em;
        }

        .
active-templates-input.gecko {
            
displayblock;
            
margin0px;
        }
 
And example of the main code:
//    create ActiveWidgets Grid javascript object
    
var obj = new Active.Controls.Grid;

    
//    create editable text template
    
var template = new My.Templates.Input;

    
//    assign new template to all columns
    
obj.setColumnTemplate(template);

    
//    provide methods for getting and setting data
    
obj.getDataText = function(ij){return myData[i][j]};
    
obj.setDataText = function(valueij){myData[i][j] = value};

    
//    set number of rows/columns
    
obj.setRowProperty("count"20);
    
obj.setColumnProperty("count"5);

    
//    write grid html to the page
    
document.write(obj);
 
Alex (ActiveWidgets)
Thursday, June 17, 2004
excellent!
kfretwell
Tuesday, June 22, 2004
I see few unexpected results and race-run situations. Ideally there shouldn’t be two cell editable at the same time… But I see many, second and futher copies same value as first one and screwing the GRID. Also at some point script error saying template is null or undefined.

Testing PC is a decent Athlon PC with 1GB of RAM. Tested on IE6 XP (sp1), So resource shouldn't be a problem...
Sudhaker Raj
Wednesday, June 23, 2004
Working fine now ;-)

1. How can we copy Column's style text-align to editor object? I'm trying to use this template for few columns not all... and if that column is right-aligned, I want editor also to be right-aligned. I did that by using this style, but looking for cleaner way...

.active-column-2, .active-column-2 input {text-alignright;}  2. How can we register some function, which will do callback when value changes?

function switchToTextMode(){
        var 
originalVal template.getItemProperty("text");
        var 
value editor.element().value;
        
template.setItemProperty("text"value);
        
template.refresh();
        if(
originalVal != value){
            
// value changed, call the callback function
            
var row template.getRowProperty("index");
            var 
col template.getColumnProperty("index");
            
// ?? something here ?? //
        
}
        
template null;
    }
 
3. I want to disable the arrow key navigation when some cell is in editing mode. How to do that?

4. This editor input box is not allowing to select text (mouse select or shift arrow-left/right). Can we enable that? If yes, how?

Thanks in advance :-)
Sudhaker Raj
Wednesday, June 23, 2004
2. How can we register some function, which will do callback when value changes?

// provide methods for getting and setting data
  
obj.getDataText = function(ij){return myData[i][j]};
  
obj.setDataText = function(valueij){myData[i][j] = value};
 
I can hook into this setDataText function ;-)

---

How can we get reference to Grid object from My.Template.Input.switchToTextMode() ?
Sudhaker Raj
Wednesday, June 23, 2004
Here is how a currency input field works for me. Any suggestions for improvements?

// **************************************************************** 
  //     Currency Cell Template. 
  // ****************************************************************
  
My.Templates.Currency Active.Templates.Text.subclass();
  
  
My.Templates.Currency.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").replace(/\,/g,'');
    });
  
    
// template variable provides temporary reference
    // to the parent template during edit mode.
    
var template;

    function 
switchToEditMode(){
        if (
template) {
            
switchToTextMode()
        }
        
template this;
        
template.element().style.padding 0;
        
template.element().innerHTML editor;
        
editor.element().focus();
    }

    
obj.setEvent("onfocus"switchToEditMode);

    function 
switchToTextMode(){
        var 
originalVal template.getItemProperty("text");
        var 
value editor.element().value;
          
try {
            if(
isNaN(value)) { alert('Please enter numbers only.');}
            var 
format = new Active.Formats.Number;
            
format.setTextFormat("#,###.##");
            
value format.dataToText(value);
          }
          
catch(error){
              
//    ignore errors
          
}
        if(
originalVal != value){
            
template.setItemProperty("text"value);
        }
        
template.refresh();
        
template null;
    }
  
    
editor.setEvent("onblur"switchToTextMode);
  };
  
  
My.Templates.Currency.create(); 

 
Sudhaker Raj
Wednesday, June 23, 2004
adding value value.replace(/[^\d\.]/g,'');  just after the alert will remove any non-numeric char and parse it. Better than showing NaN :-D
Sudhaker Raj
Wednesday, June 23, 2004
Hi.

This piece of code is very good and is exactly what we needed. The only problem we have is that with this code, when you double-click on a cell and, as you are editing, you press enter, the page jumps to another page. In our case, since the grid is enclosed within form tags, it is actually posted to the page where the form posts. Is there any way to cancel out this behaviour (the changing of the page when the 'enter' key is pressed on the keyboard)?

Any advice would be greatly appreciated.

Thanks.
ovchato
Tuesday, July 6, 2004
Any editable grid should use these

//  disable arrow key nevigation
  
obj.setEvent("onkeydown"null);

  
//  make input box selectable
  
obj.getTemplate("top").setEvent("onselectstart"obj.getEvent("onselectstart"));
  
obj.setEvent("onselectstart"null);
 
Sudhaker Raj
Thursday, July 8, 2004
THe Line

//obj.getTemplate("top").setEvent("onselectstart", obj.getEvent("onselectstart"));

causes an error

'this.$owner' is null or not an object
Matt
Wednesday, September 1, 2004
Nevermind, I had it in the wrong place. I like this form, perfect what I was looking for. Can't wait for version 2.
Matt
Wednesday, September 1, 2004
the line
template.setItemProperty("text", value);
causes an "Object don't support this property or method" error... any ideas??

my code
<script>  

if (!
window.MyMy=[];
if (!
My.TemplatesMy.Templates=[];

My.Templates.Input Active.Templates.Text.subclass();

My.Templates.Input.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(){
        if (
template) {
            
switchToTextMode()
        }
        
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 
originalVal template.getItemProperty("text"); 
        
        if(
originalVal != value){
            
template.setItemProperty("text"value);
        }
        
template.refresh();
        
template null;
    }

    
editor.setEvent("onblur"switchToTextMode);
};

My.Templates.Input.create(); 


var 
myData = [ ["MSFT","Microsoft Corporation""314,571.156""32,187.000""55000"], ["ORCL""Oracle Corporation""62,615.266""9,519.000""40650"], ["SAP""SAP AG (ADR)""40,986.328""8,296.420""28961"], ["CA""Computer Associates Inter""15,606.335""3,164.000""16000"], ["ERTS""Electronic Arts Inc.""14,490.895""2,503.727""4000"], ["SFTBF""Softbank Corp. (ADR)""14,485.840"".000""6865"], ["VRTS""Veritas Software Corp.""14,444.272""1,578.658""5647"], ["SYMC""Symantec Corporation""9,932.483""1,482.029""4300"], ["INFY""Infosys Technologies Ltd.""9,763.851""830.748""15400"], ["INTU""Intuit Inc.""9,702.477""1,650.743""6700"], ["ADBE""Adobe Systems Incorporate""9,533.050""1,230.817""3341"], ["PSFT""PeopleSoft, Inc.""8,246.467""1,941.167""8180"], ["SEBL""Siebel Systems, Inc.""5,434.649""1,417.952""5909"], ["BEAS""BEA Systems, Inc.""5,111.813""965.694""3063"], ["SNPS""Synopsys, Inc.""4,482.535""1,169.786""4254"], ["CHKP""Check Point Software Tech""4,396.853""424.769""1203"], ["MERQ""Mercury Interactive Corp.""4,325.488""444.063""1822"], ["DOX""Amdocs Limited""4,288.017""1,427.088""9400"], ["CTXS""Citrix Systems, Inc.""3,946.485""554.222""1670"], ["KNM""Konami Corporation (ADR)""3,710.784"".000""4313"] ]; 
var 
myColumns = [ "Ticker""Company Name""Market Cap.""$ Sales""Employees" ]; </script>


</
head>
<
body>
<
script>  // create ActiveWidgets Grid javascript object 
    
var obj = new Active.Controls.Grid
    
// set number of rows/columns 
    
obj.setRowCount(20); 
    
obj.setColumnCount(5); 
    
    
// provide cells and headers text 
    //    create editable text template
    
var templ = new My.Templates.Input;

    
//    assign new template to all columns
    
obj.setColumnTemplate(templ);

    
//    provide methods for getting and setting data
    
obj.getDataText = function(ij){return myData[i][j]};
    
obj.setDataText = function(valueij){myData[i][j] = value};
    
    
obj.setColumnText(function(i){return myColumns[i]}); 


    
//  disable arrow key nevigation
      
obj.setEvent("onkeydown"null);
    
      
//  make input box selectable
      
obj.getTemplate("top").setEvent("onselectstart"obj.getEvent("onselectstart"));
      
obj.setEvent("onselectstart"null); 


    
// set click action handler 
    //obj.setAction("click", function(src){window.status = src.getProperty("item/text")}); 
    // write grid html to the page 
    
document.write(obj); 

 
Sergio
Monday, September 6, 2004
I updated my grid.js to ver 1.0 and it worked!
Sergio
Monday, September 6, 2004
How do I set focus on grid object after edit a cell??
Anyone has a piece of code?
Sergio
Wednesday, September 8, 2004
How do I set focus on grid object after edit a cell??
Anyone has a piece of code?
Answer will be apreciatted...
Sergio
Friday, September 10, 2004
Here is long :-( discussion about focus...

/javascript.forum.312.7/
Alex (ActiveWidgets)
Saturday, September 11, 2004
Yes, but I mean when you edit a cell...how the edit template gets a reference to the grid (for grid.element().focus() ) ??
Sergio
Monday, September 13, 2004
The template should not know if it is inside the grid or somewhere else. So the correct solution will be to raise action and catch it in the proper parent (i.e. grid :-).

// template
...
    
template.action("restoreParentFocus");
...

// grid
    
obj.setAction("restoreParentFocus", function(){
        
this.element().focus();
    });

 
(But for some reason that doesn't work if you use tab key, I don't understand whats wrong yet.)
Alex (ActiveWidgets)
Sunday, September 19, 2004
My problem is different. I click and edit the first cell and enter say "123". After the first edit the input template invariably displays "123" again and again. Do you know a fix for that?
Manfred
Monday, September 20, 2004
Ok. It's possible to change the content of the input field, which is then written to the cell. Next cell I click for editing again shows the last edit result in the input field.
Manfred
Monday, September 20, 2004
Hy the restoreParentFocus action executes, but the focus doesn't go to the grid...any ideas?
Sergio
Wednesday, September 22, 2004
I have the same problem as Manfred about the next cell clicked after a modification.
The grid seems lose the reference to the template ... I don't understand all ...
I've tried to modify the code adding template = template.getTemplate("top")... instead of template=null; (switchToTextMode) but it doesn't work.

Thanks for your help.
Antony Guilloteau
Thursday, September 23, 2004
Seems that the switchToEditMode() executes before switchToTextMode() called by : editor.setEvent("onblur", switchToTextMode);
, Adding editor.setEvent("onmouseout", switchToTextMode); just before , works fine for me, but have the inconvenient to maintain the mouse pointer into the cell while editing. (grrrrrrrr) ;-)
Carlos
Saturday, October 2, 2004
Works fine only if I double click on one Cell (edit it) and then double click on other cell.

Issue: I double click on one Cell and then instead of double clicking on other cell, I again double click on first cell only i.e twice double clicking on 1st cell only. Now when I double click on next cell I find the contents of first cell are getting coppied to last cell I double clicked and this goes on for all the cells I double click.

Any solution to this will help me in great way.
Vikas Yadav
Monday, November 1, 2004
Hi Sudhakar,

Am getting same problem of unexpected results as you mentioned on message posed by you Wednesday, June 23. But next posting on same day shows that you managed to solve that issue. I will be very thankful if you could share your solution with me. Thank you.
Vikas Yadav
Tuesday, November 2, 2004
I think I catch the bug.
The problem is the focus executed after the "switchTo".
Solution:
just after the line : " obj.setEvent("ondblclick", switchToEditMode);"
put this one: obj.setEvent("ondblclick", this.focus);

also to prevent the "last edit item" be saved i use a mouseover-focus funtion on any header/button/etc like:

objfunc.getTemplate("top/item").setEvent("onmouseover",
function headerOVERfunc(e) {
this.element().focus(); }

(I will ask for a beta-tester "pinn" for solving this) ;-)
Carlos
Wednesday, November 3, 2004
Sorry is BEFORE
like:

obj.setEvent("ondblclick", this.focus);
obj.setEvent("ondblclick", switchToEditMode);

Thanks
Carlos
Wednesday, November 3, 2004
UUUppps the bug still there if you doubleclick on the edit box
there is something more
Carlos
Wednesday, November 3, 2004
Sorry , I was close, This is the right one !
Forget my last posts and........
last line is new

function switchToEditMode(){
if (template) {
switchToTextMode()
}
template = this;
template.element().style.padding = 0;
template.element().innerHTML = editor;
editor.element().focus();
editor.setEvent("ondblclick", editor.element().focus());
}

Carlos
Wednesday, November 3, 2004
The bug apear because any doubleclick launches the switchToEditMode (even if it is inside the edit box) and create a new instance of it.
You can also go back to text-mode (dblclicking into edit) by:
(just replace the last line)

function switchToEditMode(){
if(template) {
switchToTextMode();
}
template = this;
template.element().style.padding = 0;
template.element().innerHTML = editor;
editor.element().focus();
editor.setEvent("ondblclick", switchToTextMode);
}

Hope this help
(I win a pinn) ;-)
Carlos
Wednesday, November 3, 2004
Can someone please link to example with all the updates? I am rather confused by all the updates needed. :-) I could really use an editable version of this grid and will best learn by seeing an example.

Thanks!
Tim
Monday, December 6, 2004
Thx Carlos,

your solution workes. I got it working.

Merry Chrismas.
Vikas Yadav
Wednesday, December 22, 2004
hello, guys!

pls help me, how to refer to the grid object from a template's method:

function switchToTextMode()
{
...
var obj = template.$owner.$owner.$owner;
...
}

this works properly, but looks not so good. thanx.
DeadMoroz
Monday, February 21, 2005
Why do you need this?
Probably you can fire a custom action:

function switchToTextMode()
{
...
this.action("myAction")
...
}
 
and attach a handler to the grid object when it is created:

grid.setAction("myAction", function(src){
   var 
gridRef this;
   var 
cellRef src;
}
 
Monday, February 21, 2005
thanx, i'll try that
Monday, February 21, 2005
If you don't see the text cursor and selection in Mozilla - try this fix:

/javascript.forum.3536.1/saving-updates-to-a-database.html

Alex (ActiveWidgets)
Friday, February 25, 2005
I'm having an issue with the edit template

the line

template.setItemProperty("text", value);

is giving me the error. "Object doesn;t support this property or method"

i'm using the XML-dataset example as my base,

here is my switch to events \
function switchToEditMode(){ 
        if (
template) { 
            
switchToTextMode() 
        } 
        
template this
        
template.element().style.padding 0
        
template.element().innerHTML editor
        
editor.element().focus(); 
    
editor.setEvent("ondblclick"editor.element().focus()); 
    } 

    
obj.setEvent("ondblclick"switchToEditMode); 

    function 
switchToTextMode(){ 
        var 
value editor.element().value
        
template.setItemProperty("text"value); 
        
template.refresh(); 
        
template null
        
obj.setEvent("ondblclick"switchToEditMode); 
    } 

 
David D.
Friday, April 8, 2005
I finaly found the solution in another topic.

i had to add this to my main html file.
//    modify model to write data back to the XML 
    
table.setText = function(valueij){ 
              var 
node this.getNode(ij); 
        
node.text value
    } 
David D.
Saturday, April 9, 2005
Does anyone have a working example online that I could see.
Jason Matthews
Wednesday, April 20, 2005
by this rate of work, you guys could build a full web-excel, humm... should try that....?

is there any other widgets avalible? not just a table?
XGEN
Sunday, May 8, 2005
Hi Guys
I m a newbie to this whole web-development thing.
and i m trying to use a editable grid which read data from a text file and when clicked on "apply" button,saves data back.

I am having the same problem as David D. had in the msg posted by him on April 8
he resolved that as he posted on next day but i m not able to do so.
Plz Help.........
Vipin
if (!window.MyMy=[];
if (!
My.TemplatesMy.Templates=[];
My.Templates.Input Active.Templates.Text.subclass();
My.Templates.Input.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(){
                if (
template) {
                    
switchToTextMode()
                }
                
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 
originalVal template.getItemProperty("text");

                if(
originalVal != value){
                    
template.setItemProperty("text"value);
                }
                
template.refresh();
                
template null;
            }

            
editor.setEvent("onblur"switchToTextMode);
        };

        
My.Templates.Input.create();

</
script>
</
head>
<
body>
    <
form onsubmit="return false;">
    <
script language="Javascript">
        
//    create ActiveWidgets data model - text-based table
        
var table = new Active.Text.Table;

        
//    provide data URL - plain text comma-separated file
        
table.setURL("../data/companies.txt");

        
//    start asyncronous data retrieval
        
table.request();

        
//    define column labels
        
var columns = ["Ticker""Company Name""Market Cap.""$ Sales""Employees"];

        
// create ActiveWidgets Grid javascript object
        
var obj = new Active.Controls.Grid;

        
//    provide column labels
        
obj.setColumnProperty("texts"columns);

        
//    provide external model as a grid data source
        
obj.setDataModel(table);

        
// provide cells and headers text
        //    create editable text template
            
var templ = new My.Templates.Input;

            
//    modify model to write data back to the XML
                
table.setText = function(valueij){
                          var 
node this.getNode(ij);
                    
node.text value;
                }


        
// assign new template to all columns
        
obj.setColumnTemplate(templ);

        
//  disable arrow key nevigation
        
obj.setEvent("onkeydown"null);

        
//  make input box selectable
        
obj.getTemplate("top").setEvent("onselectstart"obj.getEvent("onselectstart"));
        
obj.setEvent("onselectstart"null);

        
// set click action handler
        
obj.setAction("click", function(src){window.status src.getProperty("item/text")});


        
// write grid html to the page
        
document.write(obj);
 
Vipin
Wednesday, May 25, 2005
save ur time
the error lies here
//    modify model to write data back to the XML 
                
table.setText = function(valueij){ 
                          var 
node this.getNode(ij); 
                    
node.text value
                } 

  
David D. is using this.getNode because its a XML Dataset if i m using a
.txt file or .csv file
wht should i use ????
Vipin
Wednesday, May 25, 2005
Version 2 is now a couple of months overdue. I'd certainly PAY this dude to finish it ;)
AcidRaZor
Saturday, May 28, 2005
When I put an alert inside the
switchToTextMode()   function the alert is generated twice on doubleclick and
I get an error stating that
template is null or not an object
at codeline template.refresh()  How is it possible to use alerts?


H.J. Pallesen
Monday, May 30, 2005
This code has GREAT promise... but alas is let down by the lack of good documentation. Alex, you could make a lot of people happy and yourself a lot of money if you worked on the documentation. How about it?!
Frustrated
Monday, June 6, 2005
To: Frustrated:

Simply adding a comment to every Forum thread stating that there is no documentation, is doing nothing positive. As a matter of fact, it is anti-productive. What you want is for Alex to spend more time creating documentation, but instead he is spending all damn day reading threads because he thinks there might actually be someone with a problem that needs assistance but instead finds that you (and a couple of other people) have simply added a useless post complaining about documentation. So instead of having time to write docs he is waisting time reading rubbish. Please stop waiting everyone's time complaining about this. Alex will be the first to admit that he needs to create better docs (and he has done this many times), and posting dozens of useless messages stating the obvious is not doing anyone any good so please stop. And while you are at it, next time you feel like posting useless messages that waste everyone's time, sign your message with your name so we all know who you are?

Sorry Alex for wasting your time with this. I hope that this puts an end to this persons posting of useless messages.
Jim Hunter
Friday, June 10, 2005
I am still getting the nasty "copy over Cell with old value" error.

does anyone know what the fix for this is. :) Carlos sounded confident his fix did not seem to work for me.

here is my current version :


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;

// 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(){
if (template) {
switchToTextMode()
}
template = this;
template.element().style.padding = 0;
template.element().innerHTML = editor;
editor.element().focus();
editor.setEvent("ondblclick", editor.element().focus());
}

obj.setEvent("ondblclick", switchToEditMode);

function switchToTextMode(){
var originalVal = template.getItemProperty("text");
var value = editor.element().value;
template.setItemProperty("text", value);
template.refresh();
if(originalVal != value){
// value changed, call the callback function
var row = template.getRowProperty("index");
var col = template.getColumnProperty("count");
// ?? something here ?? //
}
template = null;
}


editor.setEvent("onblur", switchToTextMode);
};

My.Templates.Input.create();
SteveMc
Saturday, July 2, 2005
In the function switchToTextMode(){ --- the line:
template.refresh();
must be called just before:
template = null;
See current post by Sudhaker Raj
Wednesday, June 23, 2004
Carlos
Saturday, July 2, 2005
I have used the exact same code above, but i see "undefined" in my mozilla browser.
Before adding this code, I could see the read-only grid being created in an html page, for my data.
how do i debug this "undefined" ? I have cross checked the addition of the new code, numerous times,
it seems okay.

Thanks !
Wednesday, July 6, 2005
sorry my bad, it working fine now :).
thanks.
Wednesday, July 6, 2005
Still about the problem of editing... oldvalue copied in another cell...

I found something interesting... and I look for a solution soon...

I was experiencing this problem for so long, and could never find it in the tutorials, examples... and I read this entire post hoping for my solution...

After trying everything, I removed the single-quots characters from the myData array... and the problem disappeared for me...

Now I'll start looking for text encoding method for inputs and the result shall be great once again!
Gran
Friday, July 29, 2005
Any body can help...
I need the latest grid .js which has editable control .
Thanks
venkat
Thursday, August 4, 2005
hello

im still this problem when editing a cell the value gets copied to any of them.

Struggled into the example and Carlos tips but not a nice ending...

Hope to your from anyone!

Thanks for all
Ricardo Guerra
Sunday, August 7, 2005
Ricardo , Here is a complete sample
http://activewidgets.com/javascript.forum.5633.6/how-to-make-a-cell.html

To make a clean one, just change the paths to js and css files, remove the block between "/////" (lines 58-61)
the line below "else {" (62) and "}" (67)
Also this block is not needed:
obj.setAction("AskForEdition", .........

Maybe you missed the line :
obj.setDataText = function(value, i, j){myData[i][j]=value}
HtH
Carlos
Sunday, August 7, 2005
Congratulations,

the line
obj.setDataText = function(value, i, j){myData[i][j]=value}

avoids problem with ' and " characters...

Thks
Gran
Monday, August 8, 2005
hi there Carlos!
that line gave me a hard time :)

you where correct. thx for help!

now i'm having this problem with onmouseover and the input template...
it seems that the input gets disabled with onmouseover. is this thing possible in the first place?! i think it should be but itsa maybe my code...


/javascript.forum.6537.0/input-template-doesn-t-work.html

btw, your widgets are really nice, keep it up!


Ricardo Guerra
Tuesday, August 9, 2005



This topic is archived.

Back to support forum

Forum search