locked
MSCRM2011 Retrieve Subgrid Data RRS feed

  • Question

  • Hi I would like to ask. why the following javascript not sum up when I apply into my crm2011??

    function subGridOnload() { 
    
     var grid = Xrm.Page.ui.controls.get('attachmentsGrid')._control;
     var sum =0.00;
    
     if  (grid.get_innerControl()==null)
     { 
      setTimeout(subGridOnload, 1000); 
      return; 
     } 
     else if (grid.get_innerControl()._element.innerText.search("Loading")!= -1)
     {
      setTimeout(subGridOnload, 1000); 
      return;
     }
    
     var ids = grid.get_innerControl().get_allRecordIds(); 
     var cellValue;
     for(i = 0; i < ids.length; i++) 
     { 
         if (grid.get_innerControl().getCellValue('filesize', ids[i]) !="")
         { 
           cellValue = grid.get_innerControl().getCellValue('filesize', ids[i]); 
    	   alert(cellValue);
           //cellValue = cellValue.substring(2); 
           //cellValue = parseFloat(cellValue);  
           sum =sum + cellValue;
            }	  
     }  
     alert(sum);
    
    }

    The script is to retrieve the size of attachment in a subgrid.

     

    But the alert message prompted and not show the total sum. Please Help.


    Tuesday, January 6, 2015 8:20 AM

All replies