Sorting by alt numerical value in an "i" tag.

Sorting by alt numerical value in an "i" tag.

ballchainballchain Posts: 3Questions: 1Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem: My datatable shows fontawesome check mark or x depending on whether there's a 0 or one in the database. I've tried using the alt attribute plugin to sort by adding an alt tag with either 0 or 1 (as well as tried no/yes in the tag) and it isn't working. Any advice?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • ballchainballchain Posts: 3Questions: 1Answers: 0

    Here's the test case..

    http://live.datatables.net/jelevile/1

  • kthorngrenkthorngren Posts: 21,172Questions: 26Answers: 4,923
    Answer ✓

    The problem is you have this:

            $('#dataTable').DataTable();
                columnDefs: [{ 
                    type: "alt-string", targets: 0
            }];
    

    You don't have the Datatables options being passed into the Datatables init function. It should look like this:

        $(document).ready( function () {
            $('#dataTable').DataTable({
                columnDefs: [{ 
                    type: "alt-string", targets: 0
            }]
          });
    

    Here is the updated test case:
    http://live.datatables.net/jelevile/2/edit

    Kevin

  • ballchainballchain Posts: 3Questions: 1Answers: 0

    Thank you, Kevin. Total oversight on my part leaving it out of the brackets.

This discussion has been closed.