PHP jquery datatables with CRUD just can edit pages 1

PHP jquery datatables with CRUD just can edit pages 1

developerbayudeveloperbayu Posts: 5Questions: 0Answers: 0
edited April 2014 in DataTables 1.9
Hello everyone,

I'm using jquery datatables but there's something problem.

I have total 11 records. Data tables show me 10 entries of record from database and I add column for edit and delete

when I click pagination button (next) , data tables show me record from pages 2 (record number 11 etc), but the button of edit and delete is not work

Can you help me ?

this is my link to the application

http://49.128.179.27/kbk_si/pages/ketua/data_dosen

Hope can help me :) because i'm newbie for datatables

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    I'd suggest reading the top FAQ: http://datatables.net/faqs#events .

    Allan
  • developerbayudeveloperbayu Posts: 5Questions: 0Answers: 0
    @allan
    Thanks for your feedback,
    but after i use that method , the results is same.
    :(
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Your page only shows 10 results for me, so I can't see the second page.

    Allan
  • developerbayudeveloperbayu Posts: 5Questions: 0Answers: 0
    edited April 2014
    @Allan

    I was add record please check :)

    ===

    After click edit modal on page 1 ,
    when on page 2 , the modal is same as id on page 1
  • developerbayudeveloperbayu Posts: 5Questions: 0Answers: 0
    my code for delete button now

    Still not work on page 2

    [code]
    $( ".delbutton" ).on( "click", function() {

    //Save the link in a variable called element
    var element = $(this);

    //Find the id of the link that was clicked
    var del_id = element.attr("id");

    //Built a url to send
    var info = 'id=' + del_id;
    if(confirm("Are you sure you want to delete this Lecturer ? NIK : "+del_id)){

    $.ajax({
    type: "POST",
    url: "inc_/delete_dosen",
    data: info,
    success: function(data){
    $("#loading2").html('Loading data... ').show();
    setTimeout(function() {
    $("#loading2").fadeIn();
    setTimeout(function() {
    $("#loading2").slideUp('slow');
    },4000);
    $("#loading2").html(data);
    },1000);

    }
    });

    }

    return false;

    });
    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    You haven't taken my advice from my first post...

    > $( ".delbutton" ).on( "click", function() {

    Is a static event. You want to use a delegate event.

    [code]
    $( document ).on( "click", ".delbutton", function() {
    [/code]
  • developerbayudeveloperbayu Posts: 5Questions: 0Answers: 0
    @Allan
    sorry my fault .
    i'm new on javascript hahaha

    Thanks allan for your advice ,
    now work on my localhost.

    Thank you very much!!!!
This discussion has been closed.