does not allow to edit manually added records

does not allow to edit manually added records

tponce1979tponce1979 Posts: 3Questions: 1Answers: 0

Hello Dear Friends

Buy the datatable edit license

But when inserting a record by Jquery

It does not allow me to edit it in the datatable

        var dtable = $('#DetalleFac').DataTable();         

        var rowNode = dtable
            .row.add({"NoOrden": '2020-00001', "Item": 1, "Descripcion": 'Prueba del sistema', "Cantidad": 1, "PUnitario": 1, "Total": 1})
            .draw()
            .node();

        $(rowNode)
            .css('color', 'red')
            .animate({ color: 'black' });

if anyone has the answer to this case please help me

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    edited January 2021 Answer ✓

    That's right. If you add a row that way, it's only in the local table - you need to use the Editor functionality to add that row - i.e. create().

    This example here should help - it's showing how to duplicate rows between two tables. It's using that API method so should give you a few pointers,

    Colin

  • tponce1979tponce1979 Posts: 3Questions: 1Answers: 0

    Dear Colin

    Thank you very much for your help it helps me a lot

    If it is not too much trouble, could you help me with examples of validation and performing mathematical operations when editing the cell

    For example

    add col1, row1 plus col2, row1 and save changes to col2, row1

    Thank you very much in advance

    Cheers

    Tony Ponce

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

    It really depends on your flow. If, for example, you edit a number in the first column, and you want the number in the second column to automatically update, you would do that in preSubmit so the modified value is also sent to the server. This example here shows that, where the name field is capitalised before submitting.

    If it's just a read-only column in the table, you would update the cell with cell().data().

    If you could give more information, or a link to your page/test case, we could offer more specific suggestions,

    Colin

  • tponce1979tponce1979 Posts: 3Questions: 1Answers: 0

    Dear Colin, good afternoon

    Example 1
    I would like to know how to make a specific column only allow me to type numbers

    Example # 2

    In a Column make a search button

    That is, if I enter the code of a product in a column
    In the winged column the name is displayed

    Thank you very much in advance

    regards

    Tony ponce

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    1. You could either use client-side validation, see example here, or something like jQuery mask, see example here.

    2. You could use Select2 as the field type for that - there are a few threads in the forum discussing that, such as this one.

    Colin

This discussion has been closed.