BPM, Workflow, and Case

 View Only
  • 1.  Disable checkbox in Table View with multiple select

    Posted Fri December 02, 2022 05:44 AM
    Hi,
    I have a table view (https://www.ibm.com/docs/en/baw/22.x?topic=api-table) in coach. Table rows gets populated with data depending on the results from backend. Table is configured with multiple selection - It would create a first column with checkboxes for all rows.

    What i want is - Depending on some column values, i would like to disable checkboxes for particular rows.
    Is it possible to disable checkboxes selectively in first column? 
    Also, is it possible to highlight these particular rows with different background colour.

    Many Thanks,

    ------------------------------
    Sunil
    ------------------------------


  • 2.  RE: Disable checkbox in Table View with multiple select

    IBM Champion
    Posted Fri December 02, 2022 07:08 AM
    Hi Sunil,

    You can try below code - 
    this.ui.get("sampleList1")._instance.table.rows[index].cells[0].childNodes[0].childNodes[0].setAttribute("disabled", true);
    this.ui.get("sampleList1")._instance.table.rows[index].style.backgroundColor = "some_color";​


    ------------------------------
    Atanu Roy
    Solution Architect
    Salient Process
    ------------------------------



  • 3.  RE: Disable checkbox in Table View with multiple select

    Posted Fri December 02, 2022 10:54 AM
    Edited by Sunil Hunashikatti Sat December 03, 2022 12:36 PM
    Thank you Atanu.
    It is working but when i click on select all checkbox present in table header (First column, first cell) - It selects the disabled checkboxes too.
    How to make select all checkbox option to ignore the disabled rows?


    ------------------------------
    Sunil
    ------------------------------



  • 4.  RE: Disable checkbox in Table View with multiple select

    IBM Champion
    Posted Mon December 12, 2022 07:33 AM
    Hi Sunil,

    What index are you passing ?
    This piece of code should be written in the view event of the parent view of the table. A timeout may be required - 
    var _this = this;
    setTimeout(function () {
    	_this.ui.get("sampleList1")._instance.table.rows[1].cells[0].childNodes[0].childNodes[0].setAttribute("disabled", true);
    	_this.ui.get("sampleList1")._instance.table.rows[1].style.backgroundColor = "some_color";
    }, 1);


    This will disable the first row.



    ------------------------------
    Atanu Roy
    Solution Architect
    Salient Process
    ------------------------------



  • 5.  RE: Disable checkbox in Table View with multiple select

    Posted Wed December 14, 2022 04:37 AM
    You may need to create custom check box to avail select all option, so that you can control which one to select based on some column value. 

    <input id="selectAll_tabel" style="zoom: 1.6;margin-left:5px;" type="checkbox" onclick="javascript:selectAllHandler(this)"/>

    You can write a function something like this. 

    function selectAllHandler(element) {    var selectAllChkId = "selectAll_table";    var tableId = "/Template1/Table1";     var checkboxSA = document.getElementById(selectAllChkId);    console.log(checkboxSA.checked);    var result=checkboxSA.checked;                var recordCount = page.ui.get(tableId).getRecordCount();        for (var i=0;i<recordCount;i++) {            var columnId="/Template1/Table1/Role_Map_CheckBox["+i+"]";            if(result==true)                page.ui.get(columnId).setChecked(true);            else                page.ui.get(columnId).setChecked(false);        }    
    }

    ------------------------------
    Rameshkumar Chandrasekar
    ------------------------------