wenzhixin / bootstrap-table-examples

Bootstrap table examples
https://examples.bootstrap-table.com/
MIT License
2.24k stars 1.62k forks source link

A sample based on data- is appreciated #451

Closed aducom closed 7 months ago

aducom commented 2 years ago

This is not a bug, I think I'm doing something wrong. I have created a table like:

  <table width="100%" class="" id="id_treeview_dbgrid_1" name="treeview_dbgrid_1"
  data-classes="table table-bordered table-hover table-striped table-borderless
  "
  data-toggle="table"
  data-url="?component=treeview_dbgrid_1"
  data-sort-class="table-active"
  data-sortable="true"
  data-height=""
  data-id-table="advancedTable"
  data-search="true"
  data-maintain-meta-data="true"
  data-maintain-selected="true"
  data-select-item-name="dbgrid_1_select"
  data-id-field="dbgrid_1_select"
  data-show-header="true"
  data-show-columns="true"
  data-show-refresh="true"
  data-pagination="true"
  data-show-footer="false"
  data-show-pagination-switch="true"
  data-show-toggle="true"
  data-show-fullscreen="true"
  data-loading-template="loadingTemplate" data-cache="true"
  data-detail-view="false"
  data-detail-view-by-click="false"
  data-detail-view-icon="false"
  data-detail-formatter="id_treeview_dbgrid_1_onDetailFormatter"
  data-tree-enable=true
  data-id-field="treeview_id"
  data-tree-show-field="treeview_descr"
  data-parent-id-field="treeview_pid"
  data-locale="en-US"  data-show-export="true"
  data-export-types="['json','xml','csv','txt','sql']"
  data-maintain-selected="false"
  data-row-style="id_treeview_dbgrid_1_rowStyle"
  data-side-pagination="client"
  data-page-list="[5, 10, 20, 50, 100, 250]"
  data-page-size="10"
  data-sort-order="ASC"
  data-group-by-toggle="false" data-group-by-show-toggle-icon="true" data-group-by="false"
  data-query-params="queryParams"
  data-group-by-formatter="groupByFormatter"
  >
  <thead>
  <tr>
  <th data-field="treeview_id" >id
  </th>
  <th data-field="treeview_pid" >pid
  </th>
  <th data-field="treeview_descr" >descr
  </th>
  </tr>
  </thead>

With data

{"total":11,"rows":[{"treeview_id":"1","treeview_pid":"0","treeview_descr":"a"},{"treeview_id":"2","treeview_pid":"0","treeview_descr":"b"},{"treeview_id":"3","treeview_pid":"0","treeview_descr":"c"},{"treeview_id":"4","treeview_pid":"0","treeview_descr":"d"},{"treeview_id":"10","treeview_pid":"1","treeview_descr":"aa"},{"treeview_id":"11","treeview_pid":"1","treeview_descr":"bb"},{"treeview_id":"20","treeview_pid":"2","treeview_descr":"aaa"},{"treeview_id":"21","treeview_pid":"2","treeview_descr":"bbb"},{"treeview_id":"22","treeview_pid":"2","treeview_descr":"ccc"},{"treeview_id":"23","treeview_pid":"2","treeview_descr":"ddd"},{"treeview_id":"24","treeview_pid":"2","treeview_descr":"eee"}]}

I have the javascript of the sample in place. But if I run the application then I get 'no matching records found', if I change data-tree-show-field="treeview_descr" into a non-existent field i get a list of records (but no tree).

smillove commented 2 years ago

这是一封自动回复邮件。已经收到您的来信,我会尽快回复。

wenzhixin commented 7 months ago

I'm closing this long-standing issue. If the problem still exists, could you reopen it and provide an Online Example? Thanks!