datatable sorting broke on one column with numeric values

datatable sorting broke on one column with numeric values

jsnjsn Posts: 6Questions: 2Answers: 0

Sample HTML used to construct the table:

<table class="table table table-condensed table-hover dataTable no-footer" data-id="78" id="DataTables_Table_0" role="grid" aria-describedby="DataTables_Table_0_info">
    <thead>
      <tr role="row">
        <th data-column_name="rating" data-column_id="79" class="sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="RATING : activate to sort column descending" style="width: 0px;" aria-sort="ascending">
          RATING
        </th>
        <th class="table-column-controls sorting_disabled" rowspan="1" colspan="1" aria-label="" style="width: 0px;"></th>
      </tr>
    </thead>
    <tbody>
      <tr role="row" class="odd">
        <td data-sort="100" data-search="100" class="sorting_1">
          <div class="cell-content">
            <div class="cell-view">
              100
            </div>
          </div>
        </td>
        <td class="datatable-column-control">
          <div class="cell-content">
            <div class="cell-view">
              <button class="btn btn-default btn-small">
                <span class="fa fa-ellipsis-h"></span>
              </button>
            </div>
          </div>
        </td>
      </tr>
      <tr role="row" class="even">
        <td data-sort="200" data-search="200" class="sorting_1">
          <div class="cell-content">
            <div class="cell-view">
              200
            </div>
          </div>
        </td>
        <td class="datatable-column-control">
          <div class="cell-content">
              <div class="cell-view">
                <button class="btn btn-default btn-small">
                  <span class="fa fa-ellipsis-h"></span>
                </button>
              </div>
          </div>
        </td>
      </tr>
    </tbody>
</table>

Note: the the one column, is a column of strings, then the sorting works as expected. Only when I'm trying to use numbers only does it fail. I'm not sure what may cause this. Please help. Thanks

Answers

  • jsnjsn Posts: 6Questions: 2Answers: 0

    By broken, I mean that when I click the sort arrows nothing happens

  • jsnjsn Posts: 6Questions: 2Answers: 0

    So the problem seems to lie with the contents of each column: it's either the markup within each column or the styles applied to the markup. Does this make any sense to anyone?

    I have existing tables that sort properly using one set of markup + styles and if I apply those same styles + markup to this table the sorting works. What is going on?

This discussion has been closed.