getTableCellDataByFieldName
Release 2.3.1+
Looks up table cells by data-field-name and returns their info (id and text).
Parameters
| Name | Type | Description |
|---|---|---|
fieldName | string | Field name to look up |
Returns
| Type | Description |
|---|---|
| Array | [{ id: 'tableCellId', text: 'table cell text' }, ...] |
Example
<!-- Source HTML -->
<table>
<tr>
<td id="cell_1"><p><span>1</span></p></td>
<td id="cell_2" data-field-name="test"><p><span>2</span></p></td>
</tr>
<tr>
<td id="cell_3"><p><span>3</span></p></td>
<td id="cell_4" data-field-name="test"><p><span>4</span></p></td>
</tr>
</table>
var tableCellData = editor.getTableCellDataByFieldName('test');
// returns:
// [
// { id: 'cell_2', text: '2' },
// { id: 'cell_4', text: '4' }
// ]