Pagination Sorting as well as Filtering issue

Pagination Sorting as well as Filtering issue

vikash_chaurasia1vikash_chaurasia1 Posts: 13Questions: 0Answers: 0
edited July 2010 in General
Can we achieve the Pagination/Sorting as well as filtering similar in manner as shown in the example given in the URL: http://datatables.net/index

Can we put the "Showing 1 to 10 of 58 entries First Previous Next Last" i.e. pagination functionality on the table top as well?

Please suggest how?

Replies

  • vikash_chaurasia1vikash_chaurasia1 Posts: 13Questions: 0Answers: 0
    Does anybody has any Idea?

    How we can make the same filter (Search functionality) as well as the Pagination functionality available at both the Top and bottom of the table?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yes indeed this is possible:

    Documentation: http://datatables.net/usage/options#sDom
    Example: http://datatables.net/examples/basic_init/dom.html

    Allan
  • vikash_chaurasia1vikash_chaurasia1 Posts: 13Questions: 0Answers: 0
    Thanks Allan,

    Your reply was very much helpful to me.

    I am using '<"top"if>t<"bottom"lp<"clear">' for the sDOM parameters for the final table Layout.

    Can we control everything in the final result?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yes, as noted in the documentation, all of the elements that DataTables adds to the page can be controlled with sDom. You can also add each element (with the exception of the table itself) more than once.

    Allan
  • sd_zuosd_zuo Posts: 78Questions: 1Answers: 0
    edited July 2010
    Nowadays I am using quite a few DataTables in my applications. There are many configuration codes like the following snippet repeated here and there.
    [code]
    $("#Results").css ("width", "100%").dataTable({
    "aaData": d,
    "bJQueryUI": true, "sPaginationType": "full_numbers", "sDom": '<"H"frp>t<"F"il>',
    "bAutoWidth": false, "aaSorting": [],
    "oLanguage": { "sUrl": "../scripts/localized.txt" },
    ....
    }
    [/code]
    Is it possible to specify some default settings (for example, by default turns on jQueryUI, use full number pagination, sharing a common sDom and a customized language file, etc.) for all DataTables, so the configuration can be reduced?
    [code]
    $("#Results").css ("width", "100%").dataTable({
    "aaData": d
    ....
    }
    [/code]

    Oops, I misplaced the post. I couldn't delete the above. It should be a new thread :P
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    At this time, not it is not possible to alter the defaults (well you can - just modify the source file...). One option is to define a default object for initialising the table, and then use $.extend() to clone and modify that as you need.

    Allan
  • sd_zuosd_zuo Posts: 78Questions: 1Answers: 0
    Sorry for taking your time. I found the answer here :P
    http://datatables.net/forums/comments.php?DiscussionID=1305
    Please remove my posts here if it is inappropriate.
This discussion has been closed.