class - Page 2

class

2»

Answers

  • k-georgek-george Posts: 26Questions: 3Answers: 0

    Hi,

    We updated the test case sample as

    https://live.datatables.net/tuxohazo/12/edit

    for the below query.

    The method we illustrated there is good ? or have better solutions ?

    Using this initialization method / settings at

    https://live.datatables.net/tuxohazo/7/edit

    How to add

    table.on('draw', function() {}

    and

    drawCallback: function(settings) {}

    Hanna / George & friends.

  • kthorngrenkthorngren Posts: 22,360Questions: 26Answers: 5,137

    Have toggle column visibility button for some columns.

    See if the one of the Column Visibility examples does what you want.

    How to use / express each state visibility to do something ?

    Sorry I don't understand the question.

    How to make the length menu to any other number (for example 25 rows per page and total selections have 10, 20, 25. 50 etc.) rather than the first one as default setting ?

    Use lengthMenu.

    This updated example shows using drawCallback and draw.
    https://live.datatables.net/tuxohazo/13/edit

    It shows adding draw before Datatable initialization occurs with draw.dt. This is so the event fires during any draw functions during initialization. It also shows adding the event after which will fire on draw events after Datatable initialization. You can see this by performing either a search, sort or page action.

    Kevin

  • k-georgek-george Posts: 26Questions: 3Answers: 0

    Hi,

            For the column visibility state
    

    our question was

    how to state that

    if the condition that column 2 is visible

    if that true

    then do something {}.

    and vice versa.

    Similarly about the length menu

    For example

    lengthMenu: [10, 25, 50, 75, 100]

    here 10 is the state of the total rows per page ?

    So the query was

    how to

    make 25 or 50 as the default state

    and shown value.

    But the length menu contains the same value as mentioned above.

    Hope you understand it ?

    Martha

  • kthorngrenkthorngren Posts: 22,360Questions: 26Answers: 5,137

    if the condition that column 2 is visible

    Use column().visible() for this.

    make 25 or 50 as the default state

    Use pageLength for this.

    Kevin

  • k-georgek-george Posts: 26Questions: 3Answers: 0

    Hi,

            We face some issues 
    

    drawCallback: function (settings) {

    remaining code at https://live.datatables.net/tuxohazo/15/edit

    We try to add a class to the active / last clicked cell.

    That works well.

    But we use .text() to get the element.

    And the problem is

    if have any number of cells having the same text is added the applied class.

    We only needs to apply the current clicked cell only

    So how to achieve that ?

    Sarah.

  • kthorngrenkthorngren Posts: 22,360Questions: 26Answers: 5,137
    edited December 11

    This is not a Datatables issue but an issue with how you are tracking the data. Same as the last time. You need to use a unique piece of data to restore the classes to the appropriate cell. I would look at saving the row ID plus column index, maybe use $(this).index(), instead of the cell's text. For example save each clicked cell as an array like this: [rowID, column index].

    Kevin

Sign In or Register to comment.