Something wrong with hidden cols , ordering and order indicator

Something wrong with hidden cols , ordering and order indicator

useppewinduseppewind Posts: 17Questions: 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: 61,743Questions: 1Answers: 10,111 Site admin

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

    Allan

  • useppewinduseppewind Posts: 17Questions: 0Answers: 0

    Some news?

  • useppewinduseppewind Posts: 17Questions: 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: 61,743Questions: 1Answers: 10,111 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: 17Questions: 0Answers: 0

    The workaround does not work

  • useppewinduseppewind Posts: 17Questions: 0Answers: 0

    let's try to fix the fiddle

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 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: 17Questions: 0Answers: 0

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

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 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: 17Questions: 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: 17Questions: 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: 17Questions: 0Answers: 0

    on 1.3.11 it is all ok, I am downgrading now

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 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: 17Questions: 0Answers: 0

    any news?

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

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

  • useppewinduseppewind Posts: 17Questions: 0Answers: 0

    Hi Allan

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    Hello :)

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

    Allan

Sign In or Register to comment.