IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

issue with asyncTable and javascript, how to hide a row

  • 1.  issue with asyncTable and javascript, how to hide a row

    Posted Thu July 04, 2013 02:18 PM

    Hello,

    The issue is :

    I have an asyncTable with result, I want to add a checkbox below my table, if the user check the checkbox causes the display of a specific rows of the table and mask others.
    I used the following javascript code below contains function hideRows() to hide the rows in the asyncTable following a condition, but it did not work :frowning:

    
    function hideRows(){
    
    // get the table rows
    var arrayRows = document.getElementById("#{caf:cid('defaultForm:asyncTable')}").rows; 
    
    // we apply the length property
    var length = arrayRows.length; 
    
    // we set the variable i in the loop
    for (var i=0; i<length-1; i++) {
    // get cells of the current row
    var arrayColls = arrayRows[i].cells;
    
    // get cells values
    var var1= arrayColls[0].innerHTML;
    var var2 = arrayColls[1].innerHTML;
    var var3 = arrayColls[2].innerHTML;
    
    // if difference between cells of the current row
    if(var1 != var2 || var2 != var3 || var1 != var3) {
    // hide the current row
    arrayRows[i].style.display = "none";
    } 
    }
    }

    I also used: arrayRows[i].style.display = “”; but doesn’t work
    But if i use another treatment like change the row color, it works fine, for exp : arrayRows[i].style.backgroundColor = “#EE7600”;

    please help me if you have any idea

    thanks & regards,


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 2.  RE: issue with asyncTable and javascript, how to hide a row

    Posted Fri July 05, 2013 01:43 PM


  • 3.  RE: issue with asyncTable and javascript, how to hide a row

    Posted Mon July 08, 2013 04:04 PM

    What browser are you using to test this?

    I tried something like this in firefox and it seemed to work.

    function hideRows() {
    var tableModel = CAF.model("#{caf:cid('defaultForm:asyncTable')}");
    var rowModels = tableModel.list();
    for (var i=0; i < rowModels.length; i++) {
    var rowModel = rowModels[i];
    
    //get html element for the row
    var row = rowModel.element;
    
    // get cells of the current row
    var arrayColls = row.cells;
    
    // get cells values
    var var1= arrayColls[0].innerHTML;
    var var2 = arrayColls[1].innerHTML;
    var var3 = arrayColls[2].innerHTML;
    
    // if difference between cells of the current row
    if(var1 != var2 || var2 != var3 || var1 != var3) {
    // hide the current row
    row.style.display = "none";
    }
    }
    } 

    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine


  • 4.  RE: issue with asyncTable and javascript, how to hide a row

    Posted Thu July 11, 2013 11:51 AM

    Thank you very much Eric, it works very well :slight_smile:

    Please i have another little question related to my asyncTable, i created the topic below :

    http://tech.forums.softwareag.com/techjforum/posts/list/0/51707.page#185064

    Regards


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine