XML   51

responsive index

Guest on 10th May 2022 06:09:47 PM

  1. <dt-api library="Responsive">
  2. <name>responsive.index()</name>
  3. <summary>Obtain the cell index from a `-tag li` details element</summary>
  4. <since>1.0.3</since>
  5. <type type="function">
  6. <signature>responsive.index( li )</signature>
  7. <description>Calculate the cell index from a `-tag li` details element</description>
  8. <parameter type="node|jQuery" name="li"> The `-tag li` node (or a jQuery collection containing the node) to get the cell index for. </parameter>
  9. <returns type="object">Cell object that contains the properties `row` and `column`. This object can be used as a DataTables `dt-type cell-selector`.</returns>
  10. </type>
  11. <description> When working with Responsive's details rows it can often be useful to obtain a reference to the cell, row or column that the data shown in the details row comes from. This method provides that ability, returning an object that can be used as a `dt-type cell-selector` with the `dt-api cell()` method. Note that this method requires the default renderer to be used for `r-init responsive.details.renderer`. If a custom method is used it will not be able to obtain the information required to calculate the indexes. </description>
  12. <example title="Add a class name to the host cell for data when clicked on">
  13. <![CDATA[ var table = $('#example').DataTable(); $('#example').on( 'click', 'li', function () { var cellIndx = table.responsive.index( this ); $( table.cell( cellIndex ).node() ) .addClass( 'highlight' ); } ); ]]>
  14. </example>
  15. </dt-api>

Raw Paste


Login or Register to edit or fork this paste. It's free.