Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4110
UltraWebGrid iteration in javascript
posted

Please help. I am iterating my UltraWebGrid in the BeforeRowTemplateOpenHandler to determine if the row I am on has the value "Other" in the text of the 3rd cell. If it has Other in it, I want to display DivB of my RowEditTemplate, otherwise I want to display DivA. I am doing something wrong, because it always displays DivB, no mater what row I select. Can anyone tell me what I need to do to fix this, because I'm not seeing it.

function igMyGrid_BeforeRowTemplateOpenHandler(gridName, rowId, templateId) {
    var grid = igtbl_getGridById(gridName);
    var len = grid.Rows.length;
    for (var x = 0; x < len; x++) {
        var name = grid.Rows.getRow(x).getCell(3).getValue();
        if (name.substring(0,5)=="Other" || name.substring(0,5)=="other") {
           igtbl_getElementById(templateId).children["divControls_A"].style.setAttribute('display', 'none');
            igtbl_getElementById(templateId).children["divControls_B"].style.setAttribute('display', '');
        }
        else {
            igtbl_getElementById(templateId).children["divControls_A"].style.setAttribute('display', '');
            igtbl_getElementById(templateId).children["divControls_B"].style.setAttribute('display', 'none');
        }
     
    }
 

}