question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Different tables which have one the same function (option) but in the different format and with different data

See original GitHub issue

I really have searched but nothing found on this subject. On the one page I have these two tables:

<table
  id="phones"
  data-toggle="table"
  data-search="true"
  data-detail-view="true"
  data-detail-view-icon="false"
  data-detail-view-by-click="true"
  data-detail-formatter="detailFormatter"
  data-pagination="true"
  data-url="phones.json">
  <thead>
    <tr>
      <th data-field="name">Name</th>
      <th data-field="phones">Phones</th>
    </tr>
  </thead>
</table>

AND

<table
  id="rooms"
  data-toggle="table"
  data-search="true"
  data-detail-view="true"
  data-detail-view-icon="false"
  data-detail-view-by-click="true"
  data-detail-formatter="detailFormatter"
  data-pagination="true"
  data-url="rooms.json">
  <thead>
    <tr>
      <th data-field="id">ID</th>
      <th data-field="number">Number</th>
    </tr>
  </thead>
</table>

In these tables I use the option detailFormatter

  function detailFormatter(index, row) {
    var html = []
    $.each(row, function (key, value) {
      html.push('<p><b>' + key + ':</b> ' + value + '</p>')
    })
    return html.join('')
  }

if I leave as is then these tables will use this option with the same set properties that not needed me.

I need this function (option) but in the different format and with different data and for different tables, for example:

For table with ID phones

  function detailFormatter(index, row) {
    var html = []
    $.each(row, function (key, value) {
      **### Formatting For table with ID  phones ###**
    })
    return html.join('')
  }

AND

For table with ID rooms

  function detailFormatter(index, row) {
    var html = []
    $.each(row, function (key, value) {
      **### Formatting For table with ID  rooms ###**
    })
    return html.join('')
  }

this also applies to others function nameFunction(index, row)

how to divide that functions… I need this function for first table and this function for second table…

How is it to do?

thanks advance

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
UtechtDustincommented, Jun 17, 2020

Your welcome 😃

1reaction
UtechtDustincommented, Jun 17, 2020

Im not sure what do you need then, you can define per table different function(name)s. Example: https://live.bootstrap-table.com/code/UtechtDustin/3493

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating multiple tables and table relationships - Launch School
We can split data in specialized tables that are related to one another. Such relationships include: One-to-One, One-to-Many, and Many-to-Many.
Read more >
Relationships between tables in a Data Model
A relationship is a connection between two tables of data, based on one column in each. A workbook can store each piece of...
Read more >
Splitting data into related tables (article) | Khan Academy
Basically a single table is good when data is one-to-one. When you have thousands of rows and columns of data, where the data...
Read more >
A SQL join on multiple tables: overview and implementation
Joins are used to combine the rows from multiple tables using mutual columns. As an example, assume that you have two tables within...
Read more >
How to change Excel table styles and remove table formatting
Here's another way: 1. Convert your data into a table. The default table style will be applied messing up your formatting, but you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found