Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery DataTables checkboxes in Fixed Column
    primarykey
    data
    text
    <p>I'm using the jquery.datatables plugin along with the FixedColumns add-on and am experiencing some issues keeping the two tables in sync.</p> <p>The first 2 rows of my table contain checkboxes.</p> <p>Since the data is ajax loaded I returned "true" or "false" values in the JSON for the checkboxes and I would use <code>fnRowCallback</code> to dynamically create and replace the "true" or "false" with the appropriate checkbox.</p> <p>Then I added the FixedColumns add-on and although the table initially loads correctly, subsequent redraws do not replace the "true" or "false" values with checkboxes.</p> <p>Although <code>fnRowCallback</code> still fires, it only has part of the table and only part of the data </p> <p><code>Note this code is in TypeScript but resembles JS closely enough to understand without knowing it</code></p> <pre><code> fnRowCallback: (row : DataTables.Settings, data: any[], displayIndex: number, displayIndexFull: number) : void =&gt; { if($(row).children("td.checkboxColumn").length &gt; 0){ var isFlaggedIdentifier = 'isFlaggedCheckbox_' + displayIndexFull; var isFlaggedCheckbox = $('&lt;input /&gt;', { type: 'checkbox', id: isFlaggedIdentifier, 'class': 'tableCheckboxInput', value: isFlaggedIdentifier }); var isFlaggedLabel = $('&lt;label /&gt;', { 'for': isFlaggedIdentifier, 'class': 'tableCheckboxLabel' }); var isFlagged: bool = $(row).children("td").eq(1).text() === "TRUE"; var flaggedCheckboxEntry = $(row).children("td").eq(1); if(flaggedCheckboxEntry.hasClass("checkboxColumn")){ flaggedCheckboxEntry.html(isFlaggedCheckbox); flaggedCheckboxEntry.append(isFlaggedLabel); } } } </code></pre> <p>According to docs it seems FixedColumns doesn't have an <code>fnRowCallback</code>. It only has <code>fnDrawCallback</code> which only fires once after the table it drawn so although I havent tried it I fear it will cause the "true"/"false" to flash before being replaced by checkboxes.</p> <p>If this assumption is true what can I do to replace the checkboxes before the table is rendered.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload