javascript - DataTable - Column 1 cells ( use values from array ), column 2 cells ( use custom html) -


i want create datatable wherein first column values come array , second , other columns contains custom html ( select boxes, inputs etc).i have used datatable before time reading data json ( columns ) this:

    function baskettable(data){         toptable = $('#at-top-100').datatable({              //layout of data table               "dom": 'tlfrtip',              "binfo" : false,              "bdestroy":true,              "bfilter" : false,              "responsive":true,              "aadata" : data,              "aocolumns": [                          { "mdata": "ap" },                          { "mdata": "dp" },                          { "mdata": "a"},                          { "mdata": "s"},                          { "mdata": "s"},                      ],              "idisplaylength": 10,              "olanguage": {                     "ssearch": "",                     "ssearchplaceholder" : "search..",                     "slengthmenu": " _menu_ ",               }         }); } 

any insight on how can achieve this. appreciated!!

use "mrender" function , place html want render per cell in function.

you can access properties of object in row if want use them in display. http://legacy.datatables.net/usage/columns

function baskettable(data){         toptable = $('#at-top-100').datatable({              //layout of data table               "dom": 'tlfrtip',              "binfo" : false,              "bdestroy":true,              "bfilter" : false,              "responsive":true,              "aadata" : data,              "aocolumns": [                          { "mdata": "ap" },                          { "mdata": "dp" },                          { "mdata": "a"},                          { "mdata": "s"},                          { "mdata": "s",                            "mrender": function(data,type,full)                            {                              return '<input type="text" value="scanners , scales"/>'                            }                      ],              "idisplaylength": 10,              "olanguage": {                     "ssearch": "",                     "ssearchplaceholder" : "search..",                     "slengthmenu": " _menu_ ",               }         }); } 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -