Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Feb 10, 2009 04:51
open dhtmlx forum
grid row selected cell index event when the same different different row of the same selected row is clicked

I am using 1.4 later verson

in this code when i select the row the first time click cell index of the selecter row i get the value.

if i have more then 10 cell (column) in grid when i select 4th row and click the 3rd cell

then answer is right but the same selected row when i click to another cell no value is output (no any event or answer is display)



<script language="javascript" type="text/javascript">
var a1=0;
var a2=0;
var a3=0;
var strCountry="";
window.gQueryString = new QueryString();
gQueryString.Read();
var reportId = gQueryString.GetValue("ICode");
var reportDate = gQueryString.GetValue("SDate");
var strCountryName= gQueryString.GetValue("Country");
var strGuideTypex=gQueryString.GetValue("Guide");
var strGuideType=strGuideTypex.replace("%20"," ");
var strNRI=gQueryString.GetValue("NRI");
//var strSaveMethod="insert";
var strSaveMethod=gQueryString.GetValue("Mode");
var dtFromDate=reportDate;
var strToPlace="";var dtgetdate="";var vReturnValue="#";
var strFromPlace=strCountryName.replace("%20"," ").replace("%20"," ").replace("%20"," ");
var strNoOfPerson=gQueryString.GetValue("Person");
var strCurrency=gQueryString.GetValue("Cur");
mygrid=new dhtmlXGridObject('gridbox');
mygrid.setSkin("xp");
mygrid.attachEvent("onRowSelect",doOnRowSelected);
mygrid.init();
mygrid.enableAutoHeight(true);
mygrid.enableAutoWidth(true);
mygrid.imgURL='http://'+location.host+'/Travmechanix/Images/imgs/';
//mygrid.updateFromXML("http://"+location.host+"/Travmechanix/TripPlanner/LoadData.aspx?ICode="+reportId+"&PageName=Meals",false,false );
mygrid.loadXML("http://"+location.host+"/Travmechanix/TripPlanner/LoadData.aspx?ICode="+reportId+'&Mode='+strSaveMethod+"&PageName=Meals");
myDataProcessor=new dataProcessor("http://" + location.host + "/Travmechanix/TripPlanner/SaveData.aspx?ICode="+reportId+"&PageName=Meals");
myDataProcessor.setVerificator(1)
//myDataProcessor.setVerificator(3,checkIfNotZero)
myDataProcessor.setUpdateMode("off");//available values: cell (default), row, off
//     mygrid.setOnKeyPressed(onKeyPressed);

myDataProcessor.init(mygrid);

// myDataProcessor.enableDebug(true)
// myDataProcessor.enableDataNames(true);
// myDataProcessor.setUpdateMode("off");
// myDataProcessor.setTransactionMode("POST");
//mygrid.preventIECaching(true);
mygrid.attachEvent("onXLS",function()
{

document.getElementById('div_wait').style.display="inline";
mygrid.setColumnHidden(1,true);

});
mygrid.attachEvent("onXLE",function(id)
{

document.getElementById('div_wait').style.display="none";
});


mygrid.attachEvent("onRowCreated",function(id)
{
//mygrid.cells(id,6).setValue(0);

////****great****
//mygrid.editCell();
myDataProcessor.setUpdated(id,true);
if(strSaveMethod=='insert')
{
mygrid.setUserData(id,"!nativeeditor_status","inserted");
}
else if(strSaveMethod=='delete')
{
mygrid.setUserData(id,"!nativeeditor_status","delete");
}
else
{
mygrid.setUserData(id,"!nativeeditor_status","updated");
}

///****

//mygrid.cells(id,1).cell.wasChanged=true;
});
// function onKeyPressed(code,id,shift)
//     {
//         
//         if(code==113)
//         {
//             //showPopWin('http://'+location.host+'/Travmechanix/TripPlanner/mealsPopup.aspx?PageName=Meals&SPlace='+mygrid.cells(id,3).getValue()+'&ToDate='+mygrid.cells(id,2).getValue()+'&CountryFrom='+x +'&Cur='+strCurrency +'&Person='+strNoOfPerson, 700, 450, CalRates);
//         }
//         //alert(code);
//         return true;
// }



// mygrid.attachEvent("onRowSelect",function(id){
// var z=this.getUserData(id,"!nativeeditor_status");
// alert(z);
// if(z !="inserted" || z !="deleted" ) return;
// if (rowData && rowData._id==id) return;// prevent second call against the same row

// rowData=[];
// mygrid.forEachCell(id,function(cell){
// rowData.push(cell.getValue());
// });
// rowData._id=id;//store id of related row
//});


// function doOnRowSelected(rowID,celInd){
//            if(celInd==5)
//            {
// a1=1;
// a2=0;
// a3=0;
//             showPopWin('http://'+location.host+'/Travmechanix/TripPlanner/mealsPopup.aspx?PageName=Meals&SPlace='+mygrid.cells(rowID,3).getValue()+"[" + "BreakFast" +'&ToDate='+mygrid.cells(rowID,2).getValue()+'&CountryFrom='+strFromPlace +'&Cur='+strCurrency +'&Person='+strNoOfPerson, 700, 450, CalRates);
//             }
//             else if(celInd==7)
//             {
// a1=0;
// a2=1;
// a3=0;
// showPopWin('http://'+location.host+'/Travmechanix/TripPlanner/mealsPopup.aspx?PageName=Meals&SPlace='+mygrid.cells(rowID,3).getValue()+"[" + "Lunch" +'&ToDate='+mygrid.cells(rowID,2).getValue()+'&CountryFrom='+strFromPlace +'&Cur='+strCurrency +'&Person='+strNoOfPerson, 700, 450, CalRates);
//             }
//             else if(celInd==9)
//             {
// a1=0;
// a2=0;
// a3=1;
// showPopWin('http://'+location.host+'/Travmechanix/TripPlanner/mealsPopup.aspx?PageName=Meals&SPlace='+mygrid.cells(rowID,3).getValue()+ "[" + "Dinner" + '&ToDate='+mygrid.cells(rowID,2).getValue()+'&CountryFrom='+strFromPlace +'&Cur='+strCurrency +'&Person='+strNoOfPerson, 700, 450, CalRates);
//
//             }
//        }

function doOnRowSelected(rowID,celInd){
            alert("Selected row ID is "+rowID+"\nUser clicked cell with index "+celInd);
        }



//mygrid.attachEvent("onRowSelect",function(id,ind)
//    {
// if (ind==5)
// {
// if (mygrid.cells(id,3).getValue())
// {
// a1=1;
// a2=0;
// a3=0;
// showPopWin('http://'+location.host+'/Travmechanix/TripPlanner/mealsPopup.aspx?PageName=Meals&SPlace='+mygrid.cells(id,3).getValue()+"[" + "BreakFast" +'&ToDate='+mygrid.cells(id,2).getValue()+'&CountryFrom='+strFromPlace +'&Cur='+strCurrency +'&Person='+strNoOfPerson, 700, 450, CalRates);
// ///showPopWin('http://'+location.host+'/Travmechanix/TripPlanner/MediaTrainFarepopup.aspx?PageName=TrainFare&SPlace='+mygrid.cells(id,4).getValue()+'&TSelected='+mygrid.cells(id,8).getValue()+ '&DPlace='+mygrid.cells(id,5).getValue(), 600, 400, CalRates);
// // showPopWin('http://'+location.host+'/Travmechanix/TripPlanner/MediaTrainFarepopup.aspx?PageName=TrainFare&SPlace='+mygrid.cells(id,4).getValue()+'&TSelected='+mygrid.cells(id,8).getValue()+'&ClassType='+mygrid.cells(id,8).getValue()+ '&Dplace='+mygrid.cells(id,5).getValue(), 600, 400, CalRates);
// }
//
// else
// {
// alert('Use F2 key to');
// }
// }
// else if(ind==7)
// {
// a1=0;
// a2=1;
// a3=0;
// showPopWin('http://'+location.host+'/Travmechanix/TripPlanner/mealsPopup.aspx?PageName=Meals&SPlace='+mygrid.cells(id,3).getValue()+"[" + "Lunch" +'&ToDate='+mygrid.cells(id,2).getValue()+'&CountryFrom='+strFromPlace +'&Cur='+strCurrency +'&Person='+strNoOfPerson, 700, 450, CalRates);
// }
// else if(ind==9)
//
// {
// a1=0;
// a2=0;
// a3=1;
// showPopWin('http://'+location.host+'/Travmechanix/TripPlanner/mealsPopup.aspx?PageName=Meals&SPlace='+mygrid.cells(id,3).getValue()+ "[" + "Dinner" + '&ToDate='+mygrid.cells(id,2).getValue()+'&CountryFrom='+strFromPlace +'&Cur='+strCurrency +'&Person='+strNoOfPerson, 700, 450, CalRates);
// }
// } );
//
function SetValue(returnVal)
{

vReturnValue=returnVal;
var return_array= vReturnValue.split("#");
mygrid.cells(mygrid.getSelectedId(),2).setValue(return_array[0]);


}
function CalRates(returnVal)
{
var abc=returnVal;
var return_array= abc.split("#");

if(a1=="1")
{
mygrid.cells(mygrid.getSelectedId(),5).setValue(return_array[1]);
mygrid.cells(mygrid.getSelectedId(),6).setValue(return_array[0]);
}
else if(a2=="1")
{
mygrid.cells(mygrid.getSelectedId(),7).setValue(return_array[1]);
mygrid.cells(mygrid.getSelectedId(),8).setValue(return_array[0]);
}
else if(a3="1")
{
mygrid.cells(mygrid.getSelectedId(),9).setValue(return_array[1]);
mygrid.cells(mygrid.getSelectedId(),10).setValue(return_array[0]);
}
}


function Save_Process()
{
// var chkLastDay= mygrid.cells(mygrid.getRowId(mygrid.getRowsNum()-1),7).getValue()
// if(chkLastDay==0)
// {
myDataProcessor.sendData();
window.location='http://'+location.host+'/Travmechanix/TripPlanner/CostItinerary.aspx?ICode='+reportId +'&Cur='+strCurrency+ '&Person='+strNoOfPerson +'&Country='+strCountryName +'&NRI='+strNRI +'&Guide='+strGuideType+'&Mode='+strSaveMethod;
}
Answer posted by dhxSupport on Feb 10, 2009 05:57
We can not repeat this bug. Probably it was fixed at the latest grid's version. Please contact support@dhtmlx.com to update your files