samedi 9 septembre 2017

Get row in which checkbox column is selected - knockout JS

I am totally new to Knockout JS.I am having a table in which one column is input type checkbox. at the end of html table I have one button as "Add". Now what I want to do is on click of "Add" button I should be able to get all the rows in which checkboxes are checked.

HTML

<table>
        <thead>
            <tr>
                <th>Add Data</th>
            </tr>
        </thead>
        <tbody data-bind="foreach: SearchResult">
            <tr>
                <td data-bind="text: Name"></td>
                <td><input type="checkbox" class="" data-bind="checked: selectedArray"/></td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td><button type="button" id="addButton" data-bind="click: AddSelection">Add</button></td>
            </tr>
        </tfoot>
    </table>

Now can anybody tell me how can I get all the rows in which checkbox column is checked. I have gone through this but this didn't work for me.

send information from multiple checkbox to array Knockout js




Aucun commentaire:

Enregistrer un commentaire