• Resolved MLavine

    (@mlavine)


    Tobias,

    First off, a fantastic plugin.

    Here are my questions, and I hope they are new ones but it was hard to find anything relevant when searching the forums.

    How can you change the defaults for
    a) the number of tables that are listed and the default sort order? I’m working with a large number of tables and want to view a list of 25 or 50 of them by default and preferably from highest number to lowest (although this is less critical

    b) When you create or import a table, how can you control the default settings under the Datatables Javascript Features. Having imported a large number of tables I now find I need to change what is on or off for all of them, and I’m hoping to avoid this when new tables are created.

    For example, I want Pagination: on but possibly with a default value other than 10, and I want Sorting: and Filtering: off.

    Thanks,
    Marc

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi Marc,

    thanks for your questions.

    Unfortunately, for both of them, there is no easy solution. Those default settings that you mention for the “List of tables” (number and sort order) and the default settings for the “DataTables JavaScript Features” are hard-coded into the plugin.

    Let met start with the “DataTables JavaScript Features”:
    To change those default values, take a look at the $default_table variable in line 42 of the file “controller-base.php” in the “controllers” subfolder of the plugin.
    There you can change the default state of most features (true/false).

    For the “List of tables”, there is possibility to change the default sort order, but you can not choose which tables are shown.
    To change the sort order, please see the file “controller-admin.php” in the “controllers” subfolder and go to line 1862. There, change

    "aaSorting": [],

    to

    "aaSorting": [[2, 'desc']],

    That should sort the list by the names, in descending order when the list is loaded (untested).

    Please be aware that you will have to redo any modifications you make after you update the plugin to a new version. So, it is not really a final solution and I don’t really like and recommend it, but for the moment it should work.

    Best wishes,
    Tobias

    Thread Starter MLavine

    (@mlavine)

    Tobias,

    Thanks for the rapid reply. I managed to solve some of my problems by figuring out how to edit the dump file, which let me change the settings for the 60 or so tables I had already imported. Since these were all booleans, it is easy to change the value without worrying about changing the length of the string. You can even do global search and replace, if the new string is the same length as the old one. I’m hoping to have a friend write a little Perl program (or whatever language they choose) to allow for more flexible editing of the dump file to allow for broader search and replace.

    If it is possible in a future version to make the number of tables shown in the List Tables a changeable parameter, that feature would still be very helpful. I will also likely implement the suggestions you made if I need to import another large batch of tables.

    Thanks,
    Marc

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi Marc,

    you are right, booleans in the Dump file can be changed quite easily. However, please be always careful, when editing that file, as it is quite easy to break something, so I do not really recommend working in it. But as you are aware of the “length of the string” problem, I guess you know what you are doing 🙂

    About the number of tables in the “List of Tables”: That sounds like a good suggestion, and this actually a feature in the DataTables JavaScript library, it is just turned off on that screen (but I don’t remember why I did that…). So, I’ll look into it again 🙂

    Thanks!
    Tobias

    Thread Starter MLavine

    (@mlavine)

    Tobias,

    I learned the “hard” way how easy it is to break the dump file, but fortunately you wrote the plug-in correctly so that if there is an attempt to import a defective dump file, it does not overwrite the existing tables. Thus, as long as you are prepared to recreate a dump file, or you only modify a copy of one, which is the safer approach, it wasn’t too painful a way to discover how the file is structured.

    Thanks again,
    Marc

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[Plugin: WP-Table Reloaded] Default settings’ is closed to new replies.