Bootstrap table not recognizing automatically generated rows with AJAX [on hold]












0












$begingroup$


For reference :
I'm working with Bootstrap-table using Bootstrap v3.3.6



I'm working on a data table using some extensions as the following :



<table id="table" data-toggle="table" data-pagination="true" data-search="true" data-show-columns="true" data-show-pagination-switch="true" data-show-refresh="true" data-key-events="true" data-show-toggle="true" data-resizable="true" data-cookie="true" data-cookie-id-table="saveId" data-show-export="true" data-click-to-select="true" data-toolbar="#toolbar">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th>ID</th>
<th>ISBN</th>
<th>Description</th>
</tr>
</thead>
<tbody id="books-data">
<!-- table data rows to be inserted here -->
</tbody>



If i'm filling the table using PHP everything seems to be working fine, by 'everything' i mean displaying data as well as the automatically added attributes to table rows as adding a chekbox in the first <td> and data-index attribute for every column in every row.



However, filling the table using AJAX only fills the table with data and there is no interaction between the table and its rows, no bootstrap-table attributes or checkboxes are added as well as no extensions seems to be working with those rows (for example export, rows selection ...)



For more detail :




  • When embedding PHP code into table columns:


source code :



while ($row = mysqli_fetch_array($result)){ ?>
<tr>
<td></td>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['isbn']; ?></td>
<td><?php echo $row['description']; ?></td>
</tr>
<?php } ?>


Generated code by bootstrap-table:



<tr data-index="0">
<td class="bs-checkbox ">
<input data-index="0" name="btSelectItem" type="checkbox">
</td>
<td style>
<!-- data -->
</td>
<td style> <!-- the same thing... --> </td>
</tr>




  • When generating rows dynamically using AJAX :



    <tr>
    <td></td>
    <td><!-- data --></td>
    <td><!-- data --></td>
    <td><!-- data --></td>
    </tr>



I want the result to be the same as when i embed php inside each my table, i don't even know why i'm having this issue, i need some help.










share|improve this question







New contributor




Susanoo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$



put on hold as off-topic by Jamal 6 mins ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.
















  • $begingroup$
    This is off-topic because it doesn't work. We only review working code. We don't help you write new code or new features or get your implementation working. This is also off-topic because it is stub-code. We require the code in its full in order to review it. If you do manage to get this working we would love to review it but please post the whole thing in your future questions.
    $endgroup$
    – bruglesco
    1 hour ago
















0












$begingroup$


For reference :
I'm working with Bootstrap-table using Bootstrap v3.3.6



I'm working on a data table using some extensions as the following :



<table id="table" data-toggle="table" data-pagination="true" data-search="true" data-show-columns="true" data-show-pagination-switch="true" data-show-refresh="true" data-key-events="true" data-show-toggle="true" data-resizable="true" data-cookie="true" data-cookie-id-table="saveId" data-show-export="true" data-click-to-select="true" data-toolbar="#toolbar">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th>ID</th>
<th>ISBN</th>
<th>Description</th>
</tr>
</thead>
<tbody id="books-data">
<!-- table data rows to be inserted here -->
</tbody>



If i'm filling the table using PHP everything seems to be working fine, by 'everything' i mean displaying data as well as the automatically added attributes to table rows as adding a chekbox in the first <td> and data-index attribute for every column in every row.



However, filling the table using AJAX only fills the table with data and there is no interaction between the table and its rows, no bootstrap-table attributes or checkboxes are added as well as no extensions seems to be working with those rows (for example export, rows selection ...)



For more detail :




  • When embedding PHP code into table columns:


source code :



while ($row = mysqli_fetch_array($result)){ ?>
<tr>
<td></td>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['isbn']; ?></td>
<td><?php echo $row['description']; ?></td>
</tr>
<?php } ?>


Generated code by bootstrap-table:



<tr data-index="0">
<td class="bs-checkbox ">
<input data-index="0" name="btSelectItem" type="checkbox">
</td>
<td style>
<!-- data -->
</td>
<td style> <!-- the same thing... --> </td>
</tr>




  • When generating rows dynamically using AJAX :



    <tr>
    <td></td>
    <td><!-- data --></td>
    <td><!-- data --></td>
    <td><!-- data --></td>
    </tr>



I want the result to be the same as when i embed php inside each my table, i don't even know why i'm having this issue, i need some help.










share|improve this question







New contributor




Susanoo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$



put on hold as off-topic by Jamal 6 mins ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.
















  • $begingroup$
    This is off-topic because it doesn't work. We only review working code. We don't help you write new code or new features or get your implementation working. This is also off-topic because it is stub-code. We require the code in its full in order to review it. If you do manage to get this working we would love to review it but please post the whole thing in your future questions.
    $endgroup$
    – bruglesco
    1 hour ago














0












0








0





$begingroup$


For reference :
I'm working with Bootstrap-table using Bootstrap v3.3.6



I'm working on a data table using some extensions as the following :



<table id="table" data-toggle="table" data-pagination="true" data-search="true" data-show-columns="true" data-show-pagination-switch="true" data-show-refresh="true" data-key-events="true" data-show-toggle="true" data-resizable="true" data-cookie="true" data-cookie-id-table="saveId" data-show-export="true" data-click-to-select="true" data-toolbar="#toolbar">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th>ID</th>
<th>ISBN</th>
<th>Description</th>
</tr>
</thead>
<tbody id="books-data">
<!-- table data rows to be inserted here -->
</tbody>



If i'm filling the table using PHP everything seems to be working fine, by 'everything' i mean displaying data as well as the automatically added attributes to table rows as adding a chekbox in the first <td> and data-index attribute for every column in every row.



However, filling the table using AJAX only fills the table with data and there is no interaction between the table and its rows, no bootstrap-table attributes or checkboxes are added as well as no extensions seems to be working with those rows (for example export, rows selection ...)



For more detail :




  • When embedding PHP code into table columns:


source code :



while ($row = mysqli_fetch_array($result)){ ?>
<tr>
<td></td>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['isbn']; ?></td>
<td><?php echo $row['description']; ?></td>
</tr>
<?php } ?>


Generated code by bootstrap-table:



<tr data-index="0">
<td class="bs-checkbox ">
<input data-index="0" name="btSelectItem" type="checkbox">
</td>
<td style>
<!-- data -->
</td>
<td style> <!-- the same thing... --> </td>
</tr>




  • When generating rows dynamically using AJAX :



    <tr>
    <td></td>
    <td><!-- data --></td>
    <td><!-- data --></td>
    <td><!-- data --></td>
    </tr>



I want the result to be the same as when i embed php inside each my table, i don't even know why i'm having this issue, i need some help.










share|improve this question







New contributor




Susanoo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




For reference :
I'm working with Bootstrap-table using Bootstrap v3.3.6



I'm working on a data table using some extensions as the following :



<table id="table" data-toggle="table" data-pagination="true" data-search="true" data-show-columns="true" data-show-pagination-switch="true" data-show-refresh="true" data-key-events="true" data-show-toggle="true" data-resizable="true" data-cookie="true" data-cookie-id-table="saveId" data-show-export="true" data-click-to-select="true" data-toolbar="#toolbar">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th>ID</th>
<th>ISBN</th>
<th>Description</th>
</tr>
</thead>
<tbody id="books-data">
<!-- table data rows to be inserted here -->
</tbody>



If i'm filling the table using PHP everything seems to be working fine, by 'everything' i mean displaying data as well as the automatically added attributes to table rows as adding a chekbox in the first <td> and data-index attribute for every column in every row.



However, filling the table using AJAX only fills the table with data and there is no interaction between the table and its rows, no bootstrap-table attributes or checkboxes are added as well as no extensions seems to be working with those rows (for example export, rows selection ...)



For more detail :




  • When embedding PHP code into table columns:


source code :



while ($row = mysqli_fetch_array($result)){ ?>
<tr>
<td></td>
<td><?php echo $row['id'] ?></td>
<td><?php echo $row['isbn']; ?></td>
<td><?php echo $row['description']; ?></td>
</tr>
<?php } ?>


Generated code by bootstrap-table:



<tr data-index="0">
<td class="bs-checkbox ">
<input data-index="0" name="btSelectItem" type="checkbox">
</td>
<td style>
<!-- data -->
</td>
<td style> <!-- the same thing... --> </td>
</tr>




  • When generating rows dynamically using AJAX :



    <tr>
    <td></td>
    <td><!-- data --></td>
    <td><!-- data --></td>
    <td><!-- data --></td>
    </tr>



I want the result to be the same as when i embed php inside each my table, i don't even know why i'm having this issue, i need some help.







php ajax twitter-bootstrap






share|improve this question







New contributor




Susanoo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Susanoo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Susanoo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 1 hour ago









SusanooSusanoo

11




11




New contributor




Susanoo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Susanoo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Susanoo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as off-topic by Jamal 6 mins ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.







put on hold as off-topic by Jamal 6 mins ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.












  • $begingroup$
    This is off-topic because it doesn't work. We only review working code. We don't help you write new code or new features or get your implementation working. This is also off-topic because it is stub-code. We require the code in its full in order to review it. If you do manage to get this working we would love to review it but please post the whole thing in your future questions.
    $endgroup$
    – bruglesco
    1 hour ago


















  • $begingroup$
    This is off-topic because it doesn't work. We only review working code. We don't help you write new code or new features or get your implementation working. This is also off-topic because it is stub-code. We require the code in its full in order to review it. If you do manage to get this working we would love to review it but please post the whole thing in your future questions.
    $endgroup$
    – bruglesco
    1 hour ago
















$begingroup$
This is off-topic because it doesn't work. We only review working code. We don't help you write new code or new features or get your implementation working. This is also off-topic because it is stub-code. We require the code in its full in order to review it. If you do manage to get this working we would love to review it but please post the whole thing in your future questions.
$endgroup$
– bruglesco
1 hour ago




$begingroup$
This is off-topic because it doesn't work. We only review working code. We don't help you write new code or new features or get your implementation working. This is also off-topic because it is stub-code. We require the code in its full in order to review it. If you do manage to get this working we would love to review it but please post the whole thing in your future questions.
$endgroup$
– bruglesco
1 hour ago










0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

How to make a Squid Proxy server?

Is this a new Fibonacci Identity?

19世紀