Bootstrap Table

by jimkennelly

HTML

<link rel="stylesheet" href="https://rawgit.com/wenzhixin/bootstrap-table/master/src/bootstrap-table.css">
<script src="https://rawgit.com/wenzhixin/bootstrap-table/master/src/bootstrap-table.js"></script>
<form action='process.php'>
<table id="table">
    <thead>
    <tr>
        <th data-field="isChecked" data-checkbox="true"></th>
        <th data-field="name">Name</th>
        <th data-field="stargazers_count">Stars</th>
        <th data-field="forks_count">Forks</th>
        <th data-field="description">Description</th>
    </tr>
    </thead>
</table>
<button type="submit">Save</button>
</form>

JavaScript

var myArray = ["1"];
$(function () {
    $('#table').bootstrapTable({
        data: data,
           
    })
    $('#table').on('load-success.bs.table', function (e, data) {
$("#table").bootstrapTable('checkBy', {field:'id', values: myArray});
});

    
});

var data = [
    {
    		"id": "1",
  		  "isChecked": 0,
        "name": "bootstrap-table",
        "stargazers_count": "526",
        "forks_count": "122",
        "description": "An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features. (supports twitter bootstrap v2 and v3) "
    },
    {
    		"id": "2",
	"isChecked": 0,
  "name": "multiple-select",
        "stargazers_count": "288",
        "forks_count": "150",
        "description": "A jQuery plugin to select multiple elements with checkboxes :)"
    },
   
];