Bootstrap table with data - not working

Bootstrap table with data - not working

janew2015janew2015 Posts: 2Questions: 1Answers: 0

Hello all,

I am trying to make below bootstrap table code works. Below is my code. On rendering on browser, I am getting column headers, but not the data field values. Could someone please let me know what I am doing wrong ?

<table id="table1"  data-toggle="table" data-toolbar=".toolbar">
                                    <thead>
                                    <tr>
                                        <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>

                                <script type="text/javascript">

                                    var data = [
                                                {
                                                    "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) "
                                                },
                                                {
                                                    "name": "multiple-select",
                                                    "stargazers_count": "288",
                                                    "forks_count": "150",
                                                    "description": "A jQuery plugin to select multiple elements with checkboxes :)"
                                                },
                                                {
                                                    "name": "bootstrap-show-password",
                                                    "stargazers_count": "32",
                                                    "forks_count": "11",
                                                    "description": "Show/hide password plugin for twitter bootstrap."
                                                },
                                                {
                                                    "name": "blog",
                                                    "stargazers_count": "13",
                                                    "forks_count": "4",
                                                    "description": "my blog"
                                                },
                                                {
                                                    "name": "scutech-redmine",
                                                    "stargazers_count": "6",
                                                    "forks_count": "3",
                                                    "description": "Redmine notification tools for chrome extension."
                                                }
                                            ];

                                    $(function() {   $('#table1').bootstrapTable({data: data });});

                                 </script>

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Are you actually using DataTables? Bootstrap table and DataTables are two different things.

  • janew2015janew2015 Posts: 2Questions: 1Answers: 0

    No I am not using DataTables.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Well, this is the DataTables forum.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Agreed - this is a DataTables specific forum for the software published on this site and not a general free software support forum. Closing discussion.

    Allan

This discussion has been closed.