Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ravi Booyi on Jan 12, 2009 01:13
open dhtmlx forum
Adding new row and getting values of new rows


function saveDetails()
{    
        var cmpId = $("#cname").val();
        var startDate = $("#startDate").val();
        var endDate = $("#endDate").val();
        var checkedRow = mygrid.getCheckedRows(3);
        var chkdArr = []
        var chkdArr = checkedRow.split(",");
        var temp = mygrid.getAllRowIds();
        var tempArr = temp.split(",");
       
        var unchecked = [];
        for(var i = 0; i < chkdArr.length; i++ )
       {
           var vidId = mygrid.cells(chkdArr[i],4).getValue();
           var time = mygrid.cells(chkdArr[i],1).getValue();
        var occurs = mygrid.cells(chkdArr[i],2).getValue();
        
        var videoId = [];
        var timeText = [];
        var occur = [];
        
        videoId = vidId ;
        timeText = time;
        occur = occurs ;
 
      jQuery.ajax({
        url     :"/adtvworld/campservlet",
        type    :"POST",
        data    :{action:"updateDate",cmpId:cmpId,startDate:startDate,endDate:endDate,videoId:videoId,timeText:timeText,occur:occur},
        success :function(){
        jQuery("#addStatus").fadeIn("50").text("New Videos Added...").fadeOut(9000);
                location.href = "/adtvworld/campaignServlet"
            }
              
    });
      }  
}

In my function  var checkedRow = mygrid.getCheckedRows(3); will give me all checked row id and i am getting this checked row id by passing hidden field
form servlet.    var temp = mygrid.getAllRowIds(); will give me all row ids of grid. my question is that how to take the newlly added row values. from my coding i am achiving almost result but i am structing in one point i e when i am trying adding all checked rows id it is added perfect but if i hav same row with diffrent cell values that time its iterating only once and its not taking the rows which are having same row id.. suppose i have 10 row newlly added with same id it is giving me only one row value that is last row value.
Thanks
Ravindra booyi

 


Answer posted by Support on Jan 12, 2009 02:43
>>suppose i have 10 row newlly added with same id
The grid based on conception that each row has unique ID, grid not able to separate few rows if they have the same ID.
You need to have unique IDs for each row