Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by swaroop on Mar 18, 2009 02:33
open dhtmlx forum
issue related to push setRowAttribute

we are using smart rendering via ajax
i want to save data , for that i have used rowattribute and pushed it into the grid while saving so that my backend will process it .
this works correct.
after that if we try to modify 1 value and and done the setRowAttribute and pushed it , then my serialized xml for grid shows the row attribute which was added in previous transaction
i don't want previous transaction's attribute into the existing transaction.
what can i do for it?

-----------
in more details
1] i modified 1 row
1] i done setrowattribute for 1 row
2] i posted my serializedxml to backend
3] i done loadXml again to see updated sata
4] i again modified 1 row and do the setrowattribute for that row and pushed it into grid
5] before submitting data if i see the serialized xml then it contain 1st trasaction's rowattribute also

Answer posted by dhxSupport on Mar 18, 2009 03:14
Be sure that you are using mygrid.xml.row_attrs.push(name); to add new attribute to serialization string. Also you can check what attributes row has with mygrid.getRowAttribute(row_id,name)); method. 


Answer posted on Mar 18, 2009 03:55
i am using mygrid.xml.row_attrs.push(name); perfectly
i have done testing by mygrid.getRowAttribute(row_id,name));

conclusion is
when i save data for 1st row by setting 1 attribute named "operation" with some value and posted by dhtmlxajax then grid has added this attr in 1st row perfectly
but after save when i loaded grid dynamically with jsp , and then checked for that attr for 1st row then it is not present, which is correct .
when i modified 2nd row and pushed the attribute named "operation" then in serialization it added "operation" attr 2 times , which creating bix problem to us .
Answer posted by dhxSupport on Mar 18, 2009 04:21
What version of dhtmlxGrid do you use? Could you please provide sample where this issue occurs at the support@dhtmlx.com?
Answer posted by swaroop on Mar 18, 2009 06:36
Hi,
we got the solution as below ---

 we use  grid.xml.row_attrs.push for the pusing the attribute.
 we identified what is that  attrs.push. we figured out that this is an javascript array and by "push" we are pushing  the element.
     Then we understand that , as we are not refreshing the page and using smart rendering, this array just adding the elements and there is no way to empty it (ti we are not refreshing the page).
   
    then we figured out that after smart rendering, is there any DhtmxGrid component specific values are exist into that array?
    answer was no, as only our attributes was there.
    So we made empty that array after saving , so that for next modify and save there  will not be any old attribute.
   
    In this way our problem get solved.
   

   
propertyView.prototype.postData= function(JspName,params)
{
    dhtmlxAjax.post(JspName,params,this.callbackFunction);
    // For saving we are pushing the attribute into the array "this.propertyViewGrid.xml.row_attrs"
    // As we are not refreshing the page, this array continue to update , with out removing old values
    // which causing us to add multiple attributes which causing major problem while saving
    // so make array empty after saving the data.
    // we also testing that whether dhtmlxGrid is adding any attr in it or not. but the array which we are
    // seeing has only our values so empty the array completely.
   
    this.propertyViewGrid.xml.row_attrs.splice(0,this.propertyViewGrid.xml.row_attrs.length);
   
}