Dataprocessor and custom Excel

Hello,

I’m facing a problem related to data processor and custom (readonly) Excel.

I have a custom Excel that I use to localize some data :

	function eXcell_localize(cell){
		if (cell){
			this.cell = cell;
			this.grid = this.cell.parentNode.grid;
		}
		this.edit = function(){}
		this.isDisabled = function(){ return true; }
		this.setValue=function(val){
			this.setCValue(SOME_LOCALIZE_FUNCTION(val), val);                             
		}
	}
	eXcell_localize.prototype = new eXcell;

All display fine.

But when I use dataprocessor to save new data (or update old one), dataprocessor send to my server the localized data (result of SOME_LOCALIZE_FUNCTION(val)) instead of the true value of the cell (val).
It is obviously a problem for me.

Am I doing things the wrong way ? Or is there a way to change this behaviour ?

Many thanks.

PS : By the way, you components are damn good !

You can change your code as

      this.isDisabled = function(){ return true; }
      this.getValue=function(val){
         return this.cell._original_value;
      }
      this.setValue=function(val){
         this.cell._original_value=val;
         this.setCValue(SOME_LOCALIZE_FUNCTION(val), val);                             
      }

After looking in the code, it seems that the second argument of setCValue is used for the “onCellChanged” event and is then discarded.

It seems wrong for me, a cell should have an internal value, and a “formatted” value, that is the way you render the internal value for the user. And dataprocessor should send the internal value to the serveur.

I solved the problem by redefining the getValue function, and saving the internal value

function eXcell_localize(cell){
      if (cell){
         this.cell = cell;
         this.grid = this.cell.parentNode.grid;
      }
      this.edit = function(){}
      this.isDisabled = function(){ return true; }
      this.setValue=function(val){
         this.setCValue(SOME_LOCALIZE_FUNCTION(val), val);
         this.cell.internalValue = val;                    
      }
      this.getValue = function() {
	  return this.cell.internalValue;
      }
   }
   eXcell_localize.prototype = new eXcell;

Thanks Stanislav

Didn’t see your post, but arrived to the same conclusion :slight_smile: