This topic contains 8 replies, has 2 voices, and was last updated by Jai Jai 2 weeks ago.

Select Checkboxes on Load of Datatable


  • bnickerson
    Participant

    Posts: 10
    Member Reply #18053

    Hello!

    I’m attempting to have checkboxes selected based on a bool in my dataset.  Is there a way to do that?

     

    Example Dataset

    [{name:’test1′, checked: true},{name:’test2′, checked: false},{name:’test3′, checked: true}]

     

    If there isn’t a way to do that, do you know the best way for me to loop through each row on the table?

     

    Thanks so much!

    • This topic was modified 2 weeks, 6 days ago by  bnickerson.
    Jai
    Jai
    Keymaster

    Posts: 2292
    Support Staff Reply #18085

    Hi 🙂

    Can you try to loop and use datatable.setActive(checkboxValue)?

    Thanks


    bnickerson
    Participant

    Posts: 10
    Member Reply #18100

    Thanks! The problem I’m running into is the datatable.checkbox().selectedRows doesn’t update when I do datatable.setActive(checkboxValue).


    bnickerson
    Participant

    Posts: 10
    Member Reply #18101

    For any of the functions that set checkboxes as active or inactive on the datatable (.setActive, .setInactive, .setActiveAll) don’t update the datatable.checkbox() properties.  Would be cool if it would 🙂

     

    Thanks so much Jai!

    Jai
    Jai
    Keymaster

    Posts: 2292
    Support Staff Reply #18115

    Hi @bnickerson 🙂

    Thanks for your feedback. We will fix it soon.

    Thanks


    bnickerson
    Participant

    Posts: 10
    Member Reply #18116

    Thanks Jai!

    Jai
    Jai
    Keymaster

    Posts: 2292
    Support Staff Reply #18130

    Hi 🙂

    Can you try it with the latest Metronic’s version 5.2.1?

    Thanks


    bnickerson
    Participant

    Posts: 10
    Member Reply #18133

    Yeah, I saw your change log and gave it a try. Thanks for being so quick!

    Jai
    Jai
    Keymaster

    Posts: 2292
    Support Staff Reply #18150

    All the best! 🙂

    Thanks

You must be logged in to reply to this topic.