Cascade of two bootstrap-table. A table displays the relevant data by clicking on a row of this table, passing the corresponding ID, and refreshing the other table.

Source: Internet
Author: User

Two sheets of code (I use the plugin, you can go online directly download http://issues.wenzhixin.net.cn/bootstrap-table/):

<Divclass= "Container"style= "float:left;width:500px;height:341px">              <DivID= "Toolbar">            <ButtonID= "Remove"class= "Btn Btn-danger"Disabled=""> <Iclass= "Glyphicon glyphicon-remove"></I>Delete</Button>        </Div>        <TableID= "Table"Data-toolbar= "#toolbar"Data-search= "true"Data-detail-formatter= "Detailformatter"Data-minimum-count-columns= "2"Data-show-pagination-switch= "true"data-pagination= "true"Data-id-field= "id"data-page-list= "[Ten, +, +, all]"Data-show-footer= "false"data-side-pagination= "Server"Data-url= "./system/dealer_obtainmachandname"Data-response-handler= "ResponseHandler">        </Table>    </Div>    <!--Right Linkage section -    <Divclass= "Container"style= "float:left;width:500px">       <TableID= "Tablelink"Data-toolbar= "#toolbar"Data-detail-formatter= "Detailformatter"Data-minimum-count-columns= "2"data-pagination= "true"Data-id-field= "id"data-page-list= "[Ten, +, +, all]"Data-show-footer= "false"data-side-pagination= "Server"Data-url= "./system/dealer_obtainaillermes"Data-response-handler= "ResponseHandler"Data-query-params= "Getpatientid"        </Table>    </Div>

The arrow points to my newly added function (note that it is not written like this data-query-params= "Getpatientid ()")

Then add a row click event to the first table:

        $ (' #table '). On (' check.bs.table ', function (e, row, $element) {            //  console.log (Row, $element );             // Getpatientid ();            $ (' #tablelink '). Bootstraptable (' refresh ', {url: "./system/dealer_obtainaillermes"});        

This is added to the plug-in corresponding module:

In this way, each time you click on the Refresh Method of table 2, and then pass the corresponding ID, and then update the table according to the data sent from the background.

A

Cascade two bootstrap-table. A table displays the relevant data by clicking on a row of this table, passing the corresponding ID, and refreshing the other table.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.