How can I print all the rows that have "quantity" column value more the zero

How can I print all the rows that have "quantity" column value more the zero

efintinaefintina Posts: 7Questions: 1Answers: 0

I'm quite new into datables world and I try to understand how can I work with it.
Now, I have a table with some columns. One of it is "quantity".
My question is how can I print all the rows that have "quantity" column value more the zero.
Can you help me, please?

All the bests,
Eugen

Answers

  • aintnucleoaintnucleo Posts: 2Questions: 0Answers: 0
    edited March 2020

    Hi there, i will try to help.

    The only difference between you & me is i used Copy instead of Print with exact same column named Quantity. What i did is, do filtering on Quantity column only showing row with Quantity > 0. And I've made no function to wait for filtering event to finish the job.

    So basically i just write code like this:
    <code>
    // Just call the click event on custom html button to trigger copy function
    $('.copy-button').on('click', function () {
    copy_data(window['main-table'])
    })

    // then function for the click event itself
    // 2 is my column index (3 from left)
    table.column(2).search('^[1-9][0-9]*$', true, false);

    // Do the filter here!!
    copied = table.rows({search: 'applied'}).data();

    /* I call the copy function here, you could call the print function here as well. */

    // I pass the 'false' inside draw() method to keep the table unchanged.
    // You may left the false if you want the opposite.
    table.column(2).search('').draw(false);
    </code>

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

This discussion has been closed.