Make checkbox behaves like radio button in flexgrid

Posted by: charles.nguyen-viet on 31 August 2018, 3:25 pm EST

    • Post Options:
    • Link

    Posted 31 August 2018, 3:25 pm EST

    Hi,

    I have the following flexgrid with checkbox.

    
    <wj-flex-grid control="vm.grid" items-source="vm.testJson" selection-mode="Row" sticky-headers="true" class="bento-flex-grid" >
    
                <wj-flex-grid-column header="Id"  >
                    <input type="checkbox"  />
                </wj-flex-grid-column>
    
                <wj-flex-grid-column header="Name" binding="Name" >
                </wj-flex-grid-column>
                
            </wj-flex-grid>
    
    

    How can we make the checkbox behaves like radio buttons?

    Thanks

  • Posted 3 September 2018, 1:14 am EST

    Hi,

    To make checkbox behave like radio buttons, all you need to do is keep track of selected row index and set checked property of checkbox to true if current row index matches the selectedIndex.

    Please refer to the following fiddle which implements the same:-

    https://jsfiddle.net/hLnrgf25/

    ~Sharad

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels