Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by JDM on Feb 19, 2009 08:03
open dhtmlx forum
grid.editStop()

Hi,
I have this code:
    mygrid.attachEvent("onRowDblClicked", function(rowID){
    var id = "xpto";
    var win = dhxWins.createWindow(id, 550,650,500, 250);
    dhxWins.window(id).center();
    dhxWins.window(id).setModal(true);
     var gridwin = win.attachGrid();
     gridwin.setImagePath("/codebase/imgs/");
     gridwin.setHeader("Placa,Num");
     gridwin.setInitWidths("250,250");
     gridwin.setColAlign("right,left");
     gridwin.setSkin("light");
     gridwin.enableEditEvents(true,false,false);
     gridwin.setColTypes("ro,ch");
     gridwin.enableAutoHeight(true);
gridwin.setSkin("light");
     gridwin.init();
     gridwin.attachFooter("<input type=\"button\" value=\"Save\" onclick=\"gridwin.editStop();myDataProcessor.sendData();\">",["text-align:center"]);
     gridwin.addRow(1,"Active on Boot,BOOT");
     gridwin.addRow(2,"Use DHCP,0");
     gridwin.addRow(3,"IP Address,");
     gridwin.addRow(4,"Netmask,");
     gridwin.setCellExcellType(3,1,"edn");
     gridwin.setCellExcellType(4,1,"edn");
     gridwin.cells(3,1).setValue(mygrid.cells(rowID,3).getValue());
     gridwin.cells(4,1).setValue(mygrid.cells(rowID,4).getValue());
    myDataProcessor = new dataProcessor("EthSave.pl");
myDataProcessor.enableDataNames(false);
myDataProcessor.setUpdateMode("off");
myDataProcessor.defineAction("error",myErrorHandler);
myDataProcessor.setTransactionMode("POST",true);
myDataProcessor.init(gridwin);
    return true;
});    

And the problem is when i click the "Save" Button I have the error "gridwin not defined".

Can you help me ??

Thanks
Answer posted by Support on Feb 19, 2009 09:36
You have defined gridwin as local variable - as result it accessible only inside owner function and not visible from outside, to solve issue you can change your code as

var gridwin;
mygrid.attachEvent("onRowDblClicked", function(rowID){
    ....
    gridwin = win.attachGrid();