Something wrong with hidden cols , ordering and order indicator

Something wrong with hidden cols , ordering and order indicator

useppewinduseppewind Posts: 19Questions: 0Answers: 0

As I wrote in the title, when I click on column B or E or H or S or T, it's all ok.
On the other columns the indicators fail: A, C, D, F, G, I, J, L, Y.

https://live.datatables.net/lixaculo/1/edit

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Agreed - thanks for the test case. I'll get back to you when I have a fix.

    Allan

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0

    Some news?

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0

    A workaround: there are columns on which the order target is on the 'next' column, but if I invert the two columns and set the target on the previous then it works

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    No news within the few hours between my post and your bump. I'll update this thread when I've had a chance to work on this.

    Allan

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0

    The workaround does not work

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0

    let's try to fix the fiddle

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    I've just committed a fix for this issue.

    It will be included in DataTables 2.0.1 which will land soon.

    Thanks again for the test case.

    Allan

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0

    In the fiddle on the first post it still does not work

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    I had misunderstood the issue a little bit, apologies.

    What is happening is that you are using columns.orderData to tell DataTables to order the table by the contents of a different column (the hidden columns). What is happening is that it is ordering that correctly, and it icon is shown on that hidden column (which you can see if you make it visible), since ordering is on that column!

    Perhaps a better way to do this is to use orthogonal data - have a rendering function that returns the secondary column's data for sorting:

          render: function (data, type, row) {
            if (type === 'type' || type === 'sort') {
              return row[2];
            }
            return data;
          }
    

    https://live.datatables.net/lixaculo/4/edit

    If you were ajax loading the data, this has the benefit that you would not need the hidden columns at all.

    Allan

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0

    Great!!!! this is what I needed. Here is the correct fiddle
    https://live.datatables.net/lixaculo/5/edit
    Thank you @allan

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0

    Another problem: if I change the order as here:
    https://live.datatables.net/lixaculo/6/edit
    I have put only "order: [16, 'desc']," then two indicators go crazy in column A and F

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0

    on 1.3.11 it is all ok, I am downgrading now

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    There is indeed something wrong there - thanks for letting me know. I'll look at it as soon as I can.

    Allan

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0

    any news?

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    No sorry. I've had to prioritise other things.

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0

    Hi Allan

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Hello :)

    I've not looked at this yet. Sorry. Too many other things to do recently.

    Allan

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0
    edited July 9

    ok, I can confirm that the build 2.0.8 has almost solved this problem

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Almost? What is not yet correct? Here is a little example with 2.1-dev which I'm working on just now - if you can build a set of steps or an example using that which show the issue with the latest code, I'll try to look into it.

    Thanks,
    Allan

  • useppewinduseppewind Posts: 19Questions: 0Answers: 0
    edited October 21

    Almost done.
    https://live.datatables.net/lixaculo/9/edit
    Here you can see to the left of the column labeled "SSS" there are a couple of "orphaned" indicators.
    BTW good job

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Are those floating sort indicators to the left of SSS not from the empty header cell just before it: <th rowspan="2"></th>?

    I think that looks like it is displaying correctly as configured to me?

    Allan

Sign In or Register to comment.