{"action":"opened","issue":{"url":"https://api.github.com/repos/wenzhixin/bootstrap-table/issues/566","labels_url":"https://api.github.com/repos/wenzhixin/bootstrap-table/issues/566/labels{/name}","comments_url":"https://api.github.com/repos/wenzhixin/bootstrap-table/issues/566/comments","events_url":"https://api.github.com/repos/wenzhixin/bootstrap-table/issues/566/events","html_url":"https://github.com/wenzhixin/bootstrap-table/issues/566","id":59019614,"number":566,"title":"How can i get table data from check box in table","user":{"login":"kartikdanidhariya","id":9051467,"avatar_url":"https://avatars.githubusercontent.com/u/9051467?v=3","gravatar_id":"","url":"https://api.github.com/users/kartikdanidhariya","html_url":"https://github.com/kartikdanidhariya","followers_url":"https://api.github.com/users/kartikdanidhariya/followers","following_url":"https://api.github.com/users/kartikdanidhariya/following{/other_user}","gists_url":"https://api.github.com/users/kartikdanidhariya/gists{/gist_id}","starred_url":"https://api.github.com/users/kartikdanidhariya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kartikdanidhariya/subscriptions","organizations_url":"https://api.github.com/users/kartikdanidhariya/orgs","repos_url":"https://api.github.com/users/kartikdanidhariya/repos","events_url":"https://api.github.com/users/kartikdanidhariya/events{/privacy}","received_events_url":"https://api.github.com/users/kartikdanidhariya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-26T05:04:08Z","updated_at":"2015-02-26T05:04:08Z","closed_at":null,"body":"hi,\r\ni am using your example it's a very helpful\r\nhere is my code for table\r\n\r\n{% extends \"base.html\" %}\r\n{% load sekizai_tags %}\r\n{% load menu_tags %}\r\n{% load cms_tags %}\r\n{% load cms_tags sekizai_tags menu_tags %}\r\n{% load menu_tags %}\r\n{% load i18n %}\r\n \r\n{% block base_content %}\r\n    <head>\r\n       \r\n <script src=\"https://code.jquery.com/jquery-1.11.0.min.js\"></script>\r\n\r\n        <!-- Latest compiled and minified CSS -->\r\n        <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css\">\r\n\r\n        <!-- Optional theme -->\r\n        <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css\">\r\n\r\n        <!-- Latest compiled and minified JavaScript -->\r\n        <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js\"></script>\r\n\r\n        <link rel=\"stylesheet\" href=\"https://rawgit.com/lukaskral/bootstrap-table/feature_lukaskral_bootstrap_table_filter_integration/dist/bootstrap-table.min.css\">\r\n        <script src=\"https://rawgit.com/wenzhixin/bootstrap-table/master/src/bootstrap-table.js\"></script>\r\n        <script src=\"https://rawgit.com/wenzhixin/bootstrap-table/master/src/extensions/filter/bootstrap-table-filter.js\"></script>\r\n\r\n        <link rel=\"stylesheet\" href=\"https://rawgit.com/lukaskral/bootstrap-table-filter/master/src/bootstrap-table-filter.css\">\r\n        <script src=\"https://rawgit.com/lukaskral/bootstrap-table-filter/master/src/bootstrap-table-filter.js\"></script>\r\n        <script src=\"https://rawgit.com/lukaskral/bootstrap-table-filter/master/src/ext/bs-table.js\"></script>\r\n        \r\n        <script src=\"https://rawgit.com/wenzhixin/bootstrap-table/master/src/extensions/export/bootstrap-table-export.js\"></script>\r\n        <script type=\"text/javascript\" src=\"https://rawgit.com/kayalshri/tableExport.jquery.plugin/master/tableExport.js\"></script>\r\n        <script type=\"text/javascript\" src=\"https://rawgit.com/kayalshri/tableExport.jquery.plugin/master/jquery.base64.js\"></script>\r\n        <script type=\"text/javascript\" src=\"http://wenzhixin.net.cn/p/bootstrap-table/docs/assets/table-filter/bootstrap-table-filter.js\"></script>\r\n        <script type=\"text/javascript\" src=\"http://wenzhixin.net.cn/p/bootstrap-table/docs/assets/table-filter/ext/bs-table.js\"></script>\r\n        \r\n         \r\n    </head>\r\n    \r\n    <center><font size=\"4\" color=\"#1A4067\" align=\"center\">Dashboard List</font></center><br><br>\r\n    \r\n  <div id=\"filter-bar\">\r\n        </div>\r\n  \r\n      <div id=\"toolbar\">\r\n            <button id=\"button\" class=\"btn btn-default\">getSelections</button>\r\n           \r\n        </div>  \r\n  \r\n\r\n        <table\r\n            id=\"tbl\"\r\n            data-click-to-select=\"true\"\r\n            data-toolbar=\"#filter-bar\"\r\n            data-show-toggle=\"true\"\r\n            data-show-columns=\"true\"\r\n            data-select-item-name=\"selectItemName\"\r\n            data-pagination=\"true\"\r\n            data-show-export=\"true\"\r\n            data-export-types=\"['json', 'csv']\"\r\n            data-click-to-select=\"true\"\r\n            data-search=\"true\"\r\n            >\r\n            <thead>\r\n                <tr>\r\n                    <th data-field=\"state\" data-checkbox=\"true\"></th>\r\n                    <th data-field=\"id\">id</th>\r\n                    <th data-field=\"studentname\" data-align=\"right\" data-sortable=\"true\">Student Name</th>\r\n                    <th data-field=\"status\" data-align=\"center\" data-sortable=\"true\">Status</th>\r\n                    <th>Details</th>\r\n                    \r\n                    \r\n                    \r\n                </tr>\r\n            </thead>\r\n            <tbody>   \r\n               {% get_current_language as LANGUAGE_CODE %}\r\n                {% for e in enrolls %}\r\n    \r\n                    {% if e.student_name and LANGUAGE_CODE == e.language_code %}\r\n                        <tr data-toggle=\"modal\" data-id=\"{{ e.id }}\" id=\"1\">\r\n                      \r\n                             <td data-field=\"state\" data-checkbox=\"true\"></td>\r\n                             <td data-field=\"id\" id=\"id\" name =\"id\" style=\"border:1px solid black;\">{{ e.id }}</a></td>\r\n                             <td data-field=\"name\" style=\"border:1px solid black;\">{{ e.student_name }}</a></td>\r\n                             <!--<td style=\"border:1px solid black;\">{% if e.enroll_status == 'Draft' or e.enroll_status == 'Submit' %}<a href='{{ e.get_absolute_url }}'>{% endif %}{{ e.student_name }}</a></td>-->\r\n                            <!--<td style=\"border:1px solid black;\">{{ e.course }}</td>-->\r\n                            <td  style=\"border:1px solid black;\">{{ e.enroll_status }}</td>\r\n                            <td>{% if e.enroll_status == 'Draft' or e.enroll_status == 'Submit' %}<a href='{{ e.get_absolute_url }}'>{% endif %}View Details</a></td>\r\n    \r\n                        </tr>\r\n                    {% endif %}    \r\n\r\n            {% endfor %}\r\n            </tbody>\r\n        </table>\r\n            <button id=\"show\" class=\"btn btn-default\">Show checked</button>\r\n            <button class=\"btn btn-default\" id=\"update-row\" data-method=\"updateRow\">\r\n        Update Row\r\n    </button>\r\n            <button class=\"btn btn-default\" id=\"get-selections\">\r\n        Get Selections\r\n    </button>\r\n            {% url 'dashboard_list'%}\r\n            \r\n            <form action=\"{% url 'update_subject_enroll' 2 'Approved'%}\" method=\"post\">{% csrf_token %}\r\n                <input type=\"hidden\" id=\"ids\" name=\"ids\" value=\"1,2,3\" class=\"input-block-level\">\r\n            <input type=\"hidden\" id=\"values\" name=\"values\" value=\"Approved\" class=\"input-block-level\">\r\n                \r\n            <button class=\"btn btn-large btn-primary\" type=\"submit\" name=\"btnSubmit\" type=\"btnSubmit\">Submit</button>\r\n            \r\n       \r\n    <!--<pre style=\"margin-top: 30px\" id=\"log\"></pre>-->\r\n\r\n        <script type=\"text/javascript\">\r\n            $(function() {\r\n                $('#tbl').bootstrapTable();\r\n                \r\n                $('#filter-bar').bootstrapTableFilter({\r\n                    connectTo: '#tbl',\r\n                    onAll: function(name, args) {\r\n                        var d = new Date();\r\n                        $('#log').prepend(d.toLocaleString() + ': ' + name + \"\\n\");\r\n                    },\r\n                    onSubmit: function(data) {\r\n                        var data = $('#filter-bar').bootstrapTableFilter('getData');\r\n                        var d = new Date();\r\n                        $('#log').prepend(d.toLocaleString() + ': ' + JSON.stringify(data) + \"\\n\");\r\n                    }\r\n                });\r\n                    \r\n            });\r\n\r\n        </script>\r\n        \r\n    <script>\r\n     var $table = $('#tbl');\r\n    $(function () {\r\n        $('#show').click(function () {\r\n            var str1 = \"\";\r\n            var dict = [];\r\n            var index = [];\r\n            $('input[name=\"selectItemName\"]:checked').each(function (e, row, element) {\r\n                 \r\n                \r\n                \r\n                index.push($(this).data('index'));\r\n                \r\n                \r\n            });\r\n            alert('Checked row index: ' + index.join(', '));\r\n        });\r\n    });\r\n    </script>\r\n    \r\n    <script>\r\n        \r\n        $('#get-selections').click(function() {\r\n            //var dataFieldValue = $('#tbl-methods-table tr[data-checkbox=\"true\"]').data('data-id');\r\n             var dataFieldValue = $(event.target).closest('tr').data('id');\r\n            alert (dataFieldValue)\r\n        });\r\n    </script>\r\n    \r\n    \r\n <script>\r\n    var $table = $('#tbl'),\r\n        $button = $('#button');\r\n\r\n    $(function () {\r\n        $button.click(function () {\r\n            \r\n            var a = $table.bootstrapTable('getSelections');\r\n            a[0]\r\n            \r\n            \"value of a\" + a;\r\n            alert('getSelections: ' + JSON.stringify($table.bootstrapTable('getSelections')));\r\n        });\r\n    });\r\n</script>\r\n{% endblock %}\r\n\r\n\r\nin above table how can i get table data like all rows \"id\" or \"student_name\" of cheked row on submit button click\r\ni try a lot but cant find solution \r\npls help!!!\r\nThanks in advance!!!!\r\n\r\n"}}