mendenaresh1357 - Monday, May 10, 2010 10:21 AM:
hi ,
I am unable to save values that I am wrting to a relationship grid on the client side.
Please see my code below.
I have written this on a onChangeCell event on the property. I am able to set the value on the client side but afer I save the item or search on the relationship grid again I lose all values that I set.
I tried to save the values that i get directly to the database. Though the values are saved to the database they get overwritten again after I save the parent item type or do a search again.
It seems that the relation grid is using values from a cache or some temporary intermediate table for which I have no handle.
I tried various tricks without success
Please help ..
here is my code
*********************************************************
var inno = new Innovator();
// gettin the grid
var relGrid = gridApplet;
var cellVal = gridApplet.GetCellValue(relationshipID,colNumber);
var rowcount = relGrid.GetRowCount();
var draw = relGrid.DrawGrid;
if (parseInt(rowcount) > 0)
{
var colCount = relGrid.GetColumnCount();
var selRowID = relGrid.GetSelectedID();
var action = relGrid.GetAction(selRowID);
if( parseInt(colCount) > 0)
{
for( var j=0; j<colCount; j++)
{
var colName = relGrid.GetColumnName(j);
var celltoChg = "customer_cost";
var idx = colName.indexOf(celltoChg);
if(parseInt(idx) >= 0)
{
var cell = relGrid.Cells(selRowID,j); // get cell to manipulate
var val = parseInt(cellVal)/0.3;
var i18 = inno.getI18NSessionContext();
var ntVal = i18.ConvertToNeutral(cellVal,'float','');
cell.setEditable(true);
cell.SetValue(ntVal);
//Select Item from databse to update directly
var chgQuoteRel = inno.newItem("analysis_quote","get");
chgQuoteRel.setAttribute("select","id");
chgQuoteRel.setProperty('id',selRowID);
chgQuoteRel.apply();
var lockstatus = chgQuoteRel.getLockStatus();
chgQuoteRel.apply("lock");
chgQuoteRel.setProperty('locked_by_id', top.aras.getUserID());
chgQuoteRel.SetProperty(celltoChg,ntVal);
chgQuoteRel.apply();
}
}
}
}
**********************************************************