LocalStorage + Jquery Datatable

//Llama a los datos guardados dentro de una tabla en el local storage RellenarPresiones = function () { var libp = new localStorageDB("BaseDatos", localStorage); var ja = libp.query("TablaDatos"); var datasetLocal = new Array(); var len = ja.length; for (var j = 0; j < len; j++) { datasetLocal[j] = new Array(ja[j].Campo1, ja[j].Campo2, ja[j].Campo3); } CargardatosTablePresion(datasetLocal); } //Función para crear datatable y se le pasa el dataset local con los datos de la localStorage CargardatosTablePresion = function (a) { if (a.length > 0) { $('#tablePresion').dataTable({ "data": a, "bDestroy": true, "bJQueryUI": false, "bAutoWidth": false, "sDom": '<"datatable-header"fl><"datatable-scroll"t><"datatable-footer"ip>', "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<span>Buscar:</span> _INPUT_", "sLengthMenu": "<span>Ver Registros:</span> _MENU_", "oPaginate": { "sFirst": "Primero", "sLast": "Ultimo", "sNext": ">", "sPrevious": "<" } }, "columns": [ { "title": "Campo1" }, { "title": "Campo2" }, { "title": "Campo3" } ] }); } }
Recoger datos de la localStorage y representarlos dentro de una datatable jquery.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.