:: Forum >> Version 1 >>

Select\Combo Box - selected option incorrect after change

I have been tinkering with my grid for some time now...thanks to the forums I've been able to resolve most of the issues.

I've hit a brick wall on this one.... I have 2 columns of Select Boxes - obj.setEvent("ondblclick"switchToEditMode - but when I change the value of one Select Box and then proceed to double click on another cell that contains a Select Box, the selected option/value appears as the previously changed Select Box's value.

Here is my ondblclick function...
function switchToEditMode()
{
template this;
template.element().style.padding 0;
template.element().innerHTML editor;

var 
originalText template.getItemProperty("value");

editor.element().focus();
}
 
...and here is my "editor" declaration\settings...

var editor = new Active.HTML.DIV;

editor.setId("DivMultiSelect");

editor.setTag("select");
editor.setClass("templates""input");
editor.setAttribute("type""text");
editor.setEvent("onblur", function(event) { this.switchToTextModeevent ); } );

editor.setContent"options", function()  
{
var 
text template.getItemProperty("text");
var 
column template.getColumnProperty("index");
var 
foundMe false;
var 
inputOptions obj._options;
var 
optionsHTML = new Array();

for( 
i=0iinputOptions.lengthi++ )
{
 var 
oTag = new Active.System.HTML();
 var 
val inputOptions[i][0];
 var 
txt inputOptions[i][1];

 if(
column == inputOptions[i][2]) { 
  
oTag = new Active.System.HTML();
  
oTag.setTag("option");
  
oTag.setAttribute"value"val );
  
oTag.setContent("text",inputOptions[i][1]); 
  if ( 
text==txt ){
   
oTag.setAttribute"selected","true" );
   
foundMe true;
  }
  
optionsHTML.pushoTag );
 }
}

if (!
foundMe){optionsHTML.push("<option value=\""+text+"\" selected=\"true\">"+text+"</option>");}

return 
optionsHTML.join("");
});  
 
I believe the issue is because of the single "editor" instance but I'm not sure. If you could provide some help or a link to a topic that would help I would greatly appreciate it. Thanks!
Mark
Thursday, April 7, 2005
I see what's wrong, when I load my grid using
obj.setDataProperty("text", function(ij){return myData[i][j]});
 
I should be using
obj.getDataText = function(ij){return myData[i][j]}
obj.setDataText = function(valueij){myData[i][j]=value}
 
Mark
Thursday, April 7, 2005



This topic is archived.

Back to support forum

Forum search