How use firebase in datatable

How use firebase in datatable

obskobsk Posts: 12Questions: 1Answers: 0

I understand that I need to send key, but when hidden the column, the width dont changes and fits. Help me pls!

Replies

  • kthorngrenkthorngren Posts: 21,311Questions: 26Answers: 4,948

    Not sure I understand your issue. Sounds like you are displaying a hidden table and the columns aren't the correct width. First make sure to have width="100%" defined for your table. Second when you display the hidden table use columns.adjust() to recalculate the column width.

    Is this answering your question?

    Kevin

  • obskobsk Posts: 12Questions: 1Answers: 0

    yes, thank you! It's what I need. I have an other question.
    I have a product that for some reason when clicking it stores everything and not just one?.
    How could I fix it? I'm stuck.

    thanks

    2.jpg 94.3K
  • allanallan Posts: 63,482Questions: 1Answers: 10,467 Site admin

    You'd really need to post a link to a test case showing the issue. Also, I'm afraid I don't really understand what you mean by storing everything?

    Allan

  • obskobsk Posts: 12Questions: 1Answers: 0

    Thanks Alan, I have to click on the data in a dataset that is added in imputs to edit them and then add them to another data table, what happens is that when clicking more than once the data is stored together with the Data. Attached How to add the data and the problem.

  • obskobsk Posts: 12Questions: 1Answers: 0

    I want to add only the product you selected and not the previous ones.

  • obskobsk Posts: 12Questions: 1Answers: 0

    It appears that the click event within the double-click event causes it to be stored poorly. Is there any event handler for that?

    code:
    $('#tabla tbody').on('dblclick','tr',function(){
    console.log();
    var data=table.row(this).data();
    var key=data[0];
    var repuesto=data[2];
    var modelo=data[3];
    var pais=data[4];
    var precio=parseFloat(data[5]);
    console.log(key,repuesto,modelo,pais,precio);
    var inputproducto=$('#productob').attr("placeholder",repuesto+" / "+modelo+" / "+pais).val("").focus();
    var inputprecio=$('#preciob').val(precio);
    $('#productomodal').modal('hide');
    $('#cantidad').focus();

    });
    $('#agregar').on('click',function(){
    var cantidad=$('#cantidad').val();
    var prec=$('#preciob').val();
    total= cantidad*prec;
    var rowNode=facturaadq.row.add([{},key,repuesto+"/"+pais,modelo,cantidad,prec,total]).draw().node();
    $(rowNode).css('color','red').animate({color:'black'});
    console.log(data);
    });

  • allanallan Posts: 63,482Questions: 1Answers: 10,467 Site admin

    No - PPK of QuirksMode notes:

    Don't register click and dblclick events on the same element: it's impossible to distinguish single-click events from click events that lead to a dblclick event.

    Reference.

    Allan

This discussion has been closed.