Does anybody have the example code of this table input

Does anybody have the example code of this table input

jfri_2007jfri_2007 Posts: 25Questions: 6Answers: 0
edited September 2015 in Free community support

i want to use those inputs,to compare data(inside dataTable) Written with new data by keyboard on the columns that were empty

the example is ( i want to see this all code)
https://datatables.net/examples/api/form.html

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    All the relevant code is right there on the page you linked to,

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited September 2015

    http://d.pr/i/1dpAh

    Above is a comprehensive list of instructions on how to use said Super Secret Code

    Use this power wisely.

    </joke>

  • jfri_2007jfri_2007 Posts: 25Questions: 6Answers: 0

    the super secret code that you are talking about is not dynamic because the data is in the HTML code and i need to fill the dataTable with information in a variable List to which will fill the not editable fields like this:

    http://d.pr/i/u6Du

    when i try to do so, the row loose its form

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75
    edited September 2015

    Oh, in that case, you aren't really looking so much for DataTables support, more for some actual development, if I understand you correctly.

    DataTables has plenty of Data Sources for you to be able to load data from.

    And you are saying you need it to populate the input fields in the table, correct? If so, you could....

    1. Have the actual HTML input code in the data source itself, so the <input/> is loaded into the table element
    2. Load just a string into the table cells, then use jQuery to replace the cell content with an input, and use the current cell content as the value. Heres a very basic example of what I mean:
    $( '#data-table' ).DataTable( {
        createdRow: function ( row, data, index ) {
            $( row ).find( 'td' ).each(function(i,c){
                var $cell = $(this);
                $cell.html($('<input>').attr({
                    value: $cell.text()
                }));
            });
        }
    } );
    

    Does that suffice?

  • jfri_2007jfri_2007 Posts: 25Questions: 6Answers: 0

    Actually no, I know how to get all the data from my datasource, what I need is to have empty inputs in each one of my rows so I can then edit information in this empty inputs and afterwars being able to upload the table information with the information added in the empty inputs to the Db. Was I specific enough?

  • allanallan Posts: 63,732Questions: 1Answers: 10,508 Site admin

    I think the code that @jLinux shows above using createdRow to insert input elements into the table should be of some help in that case.

    Allan

This discussion has been closed.