Table sort not working.


Topic: Table sort not working.

RoopOrem asked 5 years ago

Expected behavior I want to add table sort feature. Like this example link ( https://mdbootstrap.com/docs/jquery/tables/sort )

Actual behavior I have tried downloading the Github package and added html, css and jquery in index.html file. But getting this error that $().DataTable is not a function. ( http://prntscr.com/qeo1bv ) after that tried the same using cdn links and getting same error. ( http://prntscr.com/qeo20u )

Resources (screenshots, code snippets etc.) Used these live links.

I have used below code to make this working. Please check this live link. ( https://webmantechnologies.com/roop/TableSortMBD/mbd-sorting.html )

used this javsacript to sort my table:

$(document).ready(function () { $('#dtBasicExample').DataTable(); $('.dataTables_length').addClass('bs-select'); });


Mateusz Łubianka staff answered 5 years ago

Hi @RoopOrem,

Did you include these files? <link href="css/addons/datatables.min.css" rel="stylesheet">

<script type="text/javascript" src="js/addons/datatables.min.js"></script> I tried it in MDB Free project and it works.

Best,


RoopOrem answered 5 years ago

Hello @Mateusz Łubianka

Thanks for your help. It works for me now.

Best Regards, Roop


Mateusz Łubianka staff commented 5 years ago

I'm glad everything works :)

Best,


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.10.1
  • Device: Windows PC
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes