DHCP Leases sorting



  • On DHCP leases page ascending or desending sorting is not working correctly. None of the columns behaving correctly when sorted.


  • Developer Netgate

    Are you saying that they do not sort in the correct order? Just ran a quick test and it appeared to work correctly for me. Can you provide an example?



  • Yup they do not sort in correct order. If I click the online column it will sort a couple of top rows and ignore the rest. Desending doesn't work either.

    Just checked the host name column. Ascending works but desending fails. It will try to refresh and then shows in ascending order.

    For ip address column it's the opp, desending works ascending fails.

    When clicked second time all columns show the reversed order for about half a second and then turn to the previous order.



  • Every field sorts as you'd expect with the the exception of "online", it's sorting by something there, but it's not by online/offline status. Seems like clicking that's sorting by start or end maybe (though it's not exactly the same as sorting the start/end columns).


  • Developer Netgate

    All fields sort as I would expect.

    I have disabled sorting on the last three columns since they tend to produce unpredictable results. I need to research the secondary sort (how is the table sorted if all the entries in a column are the same?)

    Would it be possible to get a screen shot, or better yet View page source, copy all and paste into an email? That way I can attempt to replicate this with your data. Perhaps there are "special" characters in your hostnames or some other peculiarity that this would reveal.



  • @Steve_B:

    All fields sort as I would expect.

    I have disabled sorting on the last three columns since they tend to produce unpredictable results. I need to research the secondary sort (how is the table sorted if all the entries in a column are the same?)

    Would it be possible to get a screen shot, or better yet View page source, copy all and paste into an email? That way I can attempt to replicate this with your data. Perhaps there are "special" characters in your hostnames or some other peculiarity that this would reveal.

    So I just cleared the browser cache and it seems to be working fine. The Online column used to work in 2.2.x Comes in handy when you need a quick glance of all your online devices.
    Tried the same from my android tablet (Samsung Galaxy Note Pro) and it seems to behave like before .. not sorting properly.



  • Customarily secondary sorting would be by most recent previously sorted by column(s).
    But that is not the problem here.

    The problem here is that the sort routine is not honoring the colspan attribute.
    So when clicking the online header to sort, it is really sorting by the lease type column.

    PR #2583 submitted.
    Adding a description column instead of spanning the start and end columns is one way to resolve.
    Another would be to include an empty second column with the description instead of spanning.  This would not be very display/sort friendly because it would be sharing the start column for the description.
    Another would be to just display two empty cells when lease type is static, instead of the description.  This is the way status DHCPv6 leases currently works.



  • Another would be to just display two empty cells when lease type is static, instead of the description.

    It used to have "N/A" in those columns for static leases. Someone mentioned that it would be nice to see the description for static leases, as in some organisations they put something useful in the description that is more human-friendly than the host name. It was something that I could use also, so I did that change to re-use those 2 columns for description in the static lease case.

    If there is a nicer solution so that the description can still appear in that unused column space, but not interfere with the sorting, then great.


  • Developer Netgate

    Thanks. I have merged NOYB's PR but retained non-sortable Actions column.



  • feeling awesome contributing to the 2.3 build  :)

    Can this updated code be named after me… lol  ;D


  • Developer Netgate

    Absolutely. It will henceforth be known as "The Asterix table bug"



  • Phil,
    The start and end columns could be used for the description so long as it's 2 actual columns (no colspan attribute).  The second column being empty is all it takes.

    The caveats I see with that approach are:

    1. The column title "Start" becomes a little confusing when there are descriptions in there instead of times.
    2. Sorting.  Depending on the contents of the start column the descriptions could be interspersed or at top/bottom.

    Another possibility may be to put the description on a second line.  Like one of the options in firewall rules for displaying rule descriptions.

    Yet another option may be to have a separate collapsible panels for static lease and other types.