Есть ли способ сохранить все данные из таблицы табулятора в переменную в jquery / javascript?Я заметил, что у них есть метод
table.downloadToTab("json");
, который клевый, но вместо открытия в новом браузере я просто хочу сохранить в переменную.
Я знаю, что могу написать свой собственный код javascript / jquery для циклического перемещения по строкам и ячейкам, но похоже, что они не используют традиционную таблицу с <tr>
и <td>
, но все с определеннымиимена классов.
Например, это весь HTML-код, созданный только для одной строки данных в таблице табулятора:
<div class="tabulator-row tabulator-selectable tabulator-row-odd" role="row" style="padding-left: 30px;">
<div class="tabulator-cell tabulator-row-handle tabulator-frozen tabulator-frozen-left" role="gridcell" title="" style="width: 30px; position: absolute; left: 0px; height: 29px;">
<div class="tabulator-row-handle-box">
<div class="tabulator-row-handle-bar"></div>
<div class="tabulator-row-handle-bar"></div>
<div class="tabulator-row-handle-bar"></div>
</div>
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="id" title="" style="width: 150px; height: 29px;">
2134561
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="first_name" tabindex="0" title="" style="width: 150px; height: 29px;">
jane
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="last_name" tabindex="0" title="" style="width: 150px; height: 29px;">
doe
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="company" tabindex="0" title="" style="width: 150px; height: 29px;">
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="email" tabindex="0" title="" style="width: 150px; height: 29px;">
janedoe@testing.ca
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="title" tabindex="0" title="" style="width: 150px; height: 29px;">
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="registered" title="" style="width: 150px; height: 29px;">
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="speak" aria-checked="false" title="" style="width: 167px; text-align: center; height: 29px;">
<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve">
<path fill="#CE1515" d="M22.245,4.015c0.313,0.313,0.313,0.826,0,1.139l-6.276,6.27c-0.313,0.312-0.313,0.826,0,1.14l6.273,6.272 c0.313,0.313,0.313,0.826,0,1.14l-2.285,2.277c-0.314,0.312-0.828,0.312-1.142,0l-6.271-6.271c-0.313-0.313-0.828-0.313-1.141,0 l-6.276,6.267c-0.313,0.313-0.828,0.313-1.141,0l-2.282-2.28c-0.313-0.313-0.313-0.826,0-1.14l6.278-6.269 c0.313-0.312,0.313-0.826,0-1.14L1.709,5.147c-0.314-0.313-0.314-0.827,0-1.14l2.284-2.278C4.308,1.417,4.821,1.417,5.135,1.73 L11.405,8c0.314,0.314,0.828,0.314,1.141,0.001l6.276-6.267c0.312-0.312,0.826-0.312,1.141,0L22.245,4.015z"></path>
</svg>
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="paid" aria-checked="false" title="" style="width: 167px; text-align: center; height: 29px;">
<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve">
<path fill="#CE1515" d="M22.245,4.015c0.313,0.313,0.313,0.826,0,1.139l-6.276,6.27c-0.313,0.312-0.313,0.826,0,1.14l6.273,6.272 c0.313,0.313,0.313,0.826,0,1.14l-2.285,2.277c-0.314,0.312-0.828,0.312-1.142,0l-6.271-6.271c-0.313-0.313-0.828-0.313-1.141,0 l-6.276,6.267c-0.313,0.313-0.828,0.313-1.141,0l-2.282-2.28c-0.313-0.313-0.313-0.826,0-1.14l6.278-6.269 c0.313-0.312,0.313-0.826,0-1.14L1.709,5.147c-0.314-0.313-0.314-0.827,0-1.14l2.284-2.278C4.308,1.417,4.821,1.417,5.135,1.73 L11.405,8c0.314,0.314,0.828,0.314,1.141,0.001l6.276-6.267c0.312-0.312,0.826-0.312,1.141,0L22.245,4.015z"></path>
</svg>
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
<div class="tabulator-cell" role="gridcell" tabulator-field="example" title="" style="width: 167px; height: 29px;">
<a href="mailto://email" target="_blank">janedoe@testing.ca</a>
<div class="tabulator-col-resize-handle"></div>
<div class="tabulator-col-resize-handle prev"></div>
</div>
</div>
Много HTML!но я могу написать код ... я просто хочу знать, есть ли лучший способ.