Not able to update 0th row of the 7th column data !!

Not able to update 0th row of the 7th column data !!

mallikpk4umallikpk4u Posts: 14Questions: 5Answers: 0

Dear All,

I'm using the following code to update rows of the column 7. But when I specify row 0 but 8th row is updating.

table.cell({ row: 0, column: 7 }).data(0);
table.cell({ row: 1, column: 7 }).data(1);
table.cell({ row: 2, column: 7 }).data(2);

If I use above code the first row I'm getting is 8th row !!!

Thanks in advance.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,994Questions: 1Answers: 10,368 Site admin

    Can you link to a page showing the issue so we can debug it please? Also, check that you are using 1.10.18 or newer.

    Allan

  • mallikpk4umallikpk4u Posts: 14Questions: 5Answers: 0

    Dear Alan,

    Please find the webpage in the below link. Here I'm updating the 7th value using the following code.

    table.cell({ row: 0, column: 7 }).data(0);
    table.cell({ row: 1, column: 7 }).data(1);
    table.cell({ row: 2, column: 7 }).data(2);
    table.cell({ row: 3, column: 7 }).data(3);
    table.cell({ row: 4, column: 7 }).data(4);
    table.cell({ row: 5, column: 7 }).data(5);
    table.cell({ row: 6, column: 7 }).data(6);
    table.cell({ row: 7, column: 7 }).data(7);
    table.cell({ row: 8, column: 7 }).data(8);
    table.cell({ row: 9, column: 7 }).data(9);
    table.cell({ row: 10, column: 7 }).data(10);

    But here the I'm not able to update 0th row of 7th column with value 0.
    Also I'm using 1.10.2 version.

    Thank you.

  • allanallan Posts: 62,994Questions: 1Answers: 10,368 Site admin

    Hi,

    I'm afraid I don't see a link - just an image. Could you post the link again so I can debug the page?

    Thanks,
    Allan

  • colincolin Posts: 15,236Questions: 1Answers: 2,598

    Hi @mallikpk4u ,

    One thing to note, is that the row number isn't the order on the screen - the ordering can change so that makes it redundant. The ordering is the order that the rows were added into the table.

    Cheers,

    Colin

  • mallikpk4umallikpk4u Posts: 14Questions: 5Answers: 0

    Hi Alan,

    As of now I'm working in local server. How can i add the page ?

    Thank you.

  • colincolin Posts: 15,236Questions: 1Answers: 2,598

    Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • mallikpk4umallikpk4u Posts: 14Questions: 5Answers: 0

    Thank you very much Colin.

  • mallikpk4umallikpk4u Posts: 14Questions: 5Answers: 0

    Hi,

    Below is the link to the page.

    http://live.datatables.net/xidaqagu/1/

    Here I'm updating the first 10 rows of first column with new data, But I'm not able to update the data in order.

    Thank you.

  • colincolin Posts: 15,236Questions: 1Answers: 2,598
    edited September 2018 Answer ✓

    Hi @mallipk4u ,

    Yep, that's working as expected. See my first comment on this thread - the row numbering is as they were loaded. So, number 2 (your counting starts from 0) when you run the fiddle replaces 'Ashton Cox', who is the third in the list.

    If you want to number in the current order, use rows() to get the current order first, something like this:

      var idxs = table.rows({order:'current'}).indexes();
      for (var i = 0; i < idxs.count(); i++) {
        table.cell(idxs[i],1).data(i);
      }
    

    See example here,

    Cheers,

    Colin

  • mallikpk4umallikpk4u Posts: 14Questions: 5Answers: 0

    Hi Colin,

    Thanks a lot its working perfect. I used the following code to fetch the data of current page by ordering the current page. Its working as expected.

    var idxs = table.rows({page: 'current', order:'current'}).indexes();

    Thanks a lot :)

    Mallik

This discussion has been closed.