Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Feb 14, 2008 19:54
open dhtmlx forum
This is my code to get implement the refresh after updating

This is my code to get implement the refresh after updating  the values.Please suggest is any thing went wrong.



function doOnCellEdit(stage,rowId,cellInd)
{

    if(mygrid2.getSelectedCellIndex()==3)
    {if(stage == 2)
    {
        //alert('in stage 2');
        var a = mygrid2.getSelectedId();alert('index'+a);
        var b = mygrid2.getRowId(a);
        var roomWith= mygrid2.cells2(b,1).getValue();
        var comments= mygrid2.cells2(b,3).getValue();
        
        var url = '<%=appPath%&gt;/generateXMLTSPinsert.do?mode=update';
    if (window.XMLHttpRequest)
    {
        req = new XMLHttpRequest();
    }
    else if(window.ActiveXObject)
    {
        req = new ActiveXObject('Microsoft.XMLHTTP');
    }
    req.open('POST', url,false);
    req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    //req.onreadystatechange = callback;
    req.send('tournum='+document.forms[0].tourid.value+'&amp;tourdate='+ document.forms[0].tourdate.value+'&amp;tourcode='+ document.forms[0].tourcode.value+'&amp;roomWith='+roomWith+'&amp;comments='+comments);

mygrid2.updateFromXML('gridpal2.xml');
}
}
Answer posted by Support on Feb 15, 2008 05:32
I'm not sure why do you need to use
    mygrid2.getSelectedCellIndex
    var a = mygrid2.getSelectedId();
    var b = mygrid2.getRowId(a);

The event handler already have necessary info

var roomWith= mygrid2.cells2(rowId,1).getValue();        
var comments= mygrid2.cells2(rowId,3).getValue();
Answer posted by Support on Feb 15, 2008 05:33
Also you code misses
    return true;
at the end, without such line edit operation will be blocked.