Closed tabago closed 10 years ago
Hello @tabago. I will not be merging pull request until all the tests pass. Changing table selector from table.children('tbody,*')
to table.children('tbody')
is actually a very large change and causes almost all the tests to break. I see you want to add a ignoreRows
options, which I support completely, but I don't see why the table selector needed to be changed. If you could give me some details about what you are trying to accomplish, then maybe I and the other maintainers could give assistance.
Wouldn't it be better to add a class name to ignore instead of row indexes? If a table is sortable or has rows that can be arranged, row indexing would be worthless.
@Mottie you bring up a good point. Also, if you already know the index of the row you want to ignore, then it should be just as easy to delete that row from the resulting array. Perhaps we could add a data-ignore="true"
attribute to the row... although I'm still not sure how this could be useful. You ether want all the rows or none of them normally.... I could see if there was a hidden row that contains control data... but we already ignore hidden rows by default
table of data-ignore = "true" every time you need to add to the head table head if it does not require data-ignore = "true" should be added to the required part amicably, but if you think you've added.
@tabago I do not understand what you said. Do you like the idea of setting data-ignore="true"
on any <tr>
elements that should be ignored?
example:
<table>
<tr><th>Heading</th></tr>
<tr><td>Row 1</td></tr>
<tr data-ignore="true"><td>Ignored Row</td></tr>
<tr><td>Row 3</td></tr>
</table>
i am sorray I apology for delayed reply.
<table>
<tr><th>Heading</th></tr>
<tr><td>Row 1</td></tr>
<tr><td>Ignored Row</td></tr>
<tr><td>Row 3</td></tr>
</table>
i want to no tag data-ignore="true" option add var defaults = { ignoreColumns: [], ignoreRows:[] }; opts = $.extend(defaults, opts);
table.children('tbody,').children('tr') ->table.children('tbody').children('tr') i think 'tbody' include in '' -->I'm thinking about it ㅠ.ㅠ
one question !!!
<script>
var table = $('#example-table').tableToJSON();
table = JSON.stringify(table);
$('#table').val(table);
.......
</script>
<form action="..." method="post">
<input type="hidden" name="table" id="table">
</form>
php submit php server script $ssss = $_POST('table'); echo $ssss; -> [{\'a':\'aaa',\'b':\'bbb'}] why directory separator windows i don't know include directory separator windows
source code $ssss = stripslashes($_POST('table')); echo $ssss; ㅠ.ㅠ
@tabago ignoring a specific row does not require any new features to Table to Json. If you want to remove a row from the results, this is how to do it:
<table id='example'>
<tr><th>Heading</th></tr>
<tr><td>Row 1</td></tr>
<tr><td>Row 2</td></tr>
<tr><td>Ignored Row</td></tr>
</table>
<script type="text/javascript">
var table = $('#example').tableToJSON(); // this gets the array of the table
table.splice(2, 1); // this removes the 3rd row from the results
// now table doesn't have the 3rd row in it anymore
// so do whatever you need to do with it
</script>
For more information on how to add or remove items from a JavaScript array, see the slice method
options ignoreRows add modified to include only the table below tbody