Table with x editable and pagination

Table with x editable and pagination

gmisterkgmisterk Posts: 4Questions: 2Answers: 0

Hi all
I use table with x editable and all works fine. But when I browser to next page my editable input dont show the value. Input is empty.

Must I Initialize m'y input each time I change the page ?

Si why Its work for the first page and not for Other ?

Thanks for your Help

Replies

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @gmisterk ,

    Would you be able to provide a live example so we can look at the code?

    Cheers,

    Colin

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    A perfect match for this FAQ :).

    Allan

  • gmisterkgmisterk Posts: 4Questions: 2Answers: 0
    edited April 2018

    Hi allan,

    I've read the faq and this example don't help me :

    $(document).ready(function() {
        var table = $('#example').DataTable();
         
        $('#example tbody').on('click', 'tr', function () {
            var data = table.row( this ).data();
            alert( 'You clicked on '+data[0]+'\'s row' );
        } );
    } );
    

    Here is my code

    I initilize my editor input like this :

    php
    <td><a style="font-weight:bold; height: 3em;padding: 0px 12px;font-size: 0.8em;" href="#" id="memo" class="frominscrmemo"  data-type="text" data-value="' . $row['memo'] . '"   data-pk="' . $row['id'] . '"  data-idcard="' . $row['idcard'] . '" data-emailprive="' . $row['emailprive'] . '"   data-url="jumpeme" ></a></td>
    

    ?
    initialisation work fine for the first page but not for others

    I have tried this but without success ::

    $('#tablo').on('page.dt', function() {
      var info = table.page.info();
    
      $(".frominscrmemo").each(function(index) {
        console.log(this);
        $(this).editable({
          showbuttons: false,
          placeholder: '',
          tpl: '<input type="text"  maxlength="60"/>',
          params: function(params) {
            params.mail = $(this).editable().data("mail");
            return params;
          }
        });
      });
    });
    

    When i go to the second page, I have seen that this line

     $(".frominscrmemo").each(function (index) {}
    

    give me only elements of the first page

    Thanks for any help

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @gmisterk ,

    I guess it depends on how the element on the first page get assigned the "frominscrmemo" class. You would need to give that class to the other pages as they're drawn.

    I knocked out this example for another thread post recently - it highlights matching rows on the current page. It's not the same as yours, but the logic may give you some clues as which way to go.

    Hope that helps,

    Cheers,

    Colin

This discussion has been closed.