forked from Business/BinStack
Add item search box on dashboard (close #6)
parent
ae4511cad7
commit
40def2bf70
@ -1,64 +1,73 @@
|
|||||||
var itemtable = $('#itemtable').DataTable({
|
var itemtable = $('#itemtable').DataTable({
|
||||||
responsive: {
|
responsive: {
|
||||||
details: {
|
details: {
|
||||||
display: $.fn.dataTable.Responsive.display.modal({
|
display: $.fn.dataTable.Responsive.display.modal({
|
||||||
header: function (row) {
|
header: function (row) {
|
||||||
var data = row.data();
|
var data = row.data();
|
||||||
return "<i class=\"fa fa-cube fa-fw\"></i> " + data[2];
|
return "<i class=\"fa fa-cube fa-fw\"></i> " + data[2];
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
renderer: $.fn.dataTable.Responsive.renderer.tableAll({
|
renderer: $.fn.dataTable.Responsive.renderer.tableAll({
|
||||||
tableClass: 'table'
|
tableClass: 'table'
|
||||||
}),
|
}),
|
||||||
type: "column"
|
type: "column"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{
|
{
|
||||||
targets: 0,
|
targets: 0,
|
||||||
className: 'control',
|
className: 'control',
|
||||||
orderable: false
|
orderable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 1,
|
targets: 1,
|
||||||
orderable: false
|
orderable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
targets: 8,
|
targets: 8,
|
||||||
orderable: false
|
orderable: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
order: [
|
order: [
|
||||||
[2, 'asc']
|
[2, 'asc']
|
||||||
],
|
],
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
ajax: {
|
ajax: {
|
||||||
url: "lib/getitemtable.php",
|
url: "lib/getitemtable.php",
|
||||||
data: function (d) {
|
data: function (d) {
|
||||||
if (filter == "stock") {
|
if (filter == "stock") {
|
||||||
d.show_want = 1;
|
d.show_want = 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dataFilter: function (data) {
|
dataFilter: function (data) {
|
||||||
var json = jQuery.parseJSON(data);
|
var json = jQuery.parseJSON(data);
|
||||||
json.data = [];
|
json.data = [];
|
||||||
json.items.forEach(function (row) {
|
json.items.forEach(function (row) {
|
||||||
json.data.push([
|
json.data.push([
|
||||||
"",
|
"",
|
||||||
row.editbtn + " " + row.clonebtn,
|
row.editbtn + " " + row.clonebtn,
|
||||||
row.name,
|
row.name,
|
||||||
row.catname,
|
row.catname,
|
||||||
row.locname + " (" + row.loccode + ")",
|
row.locname + " (" + row.loccode + ")",
|
||||||
row.code1,
|
row.code1,
|
||||||
row.code2,
|
row.code2,
|
||||||
row.qty,
|
row.qty,
|
||||||
row.want,
|
row.want,
|
||||||
row.username
|
row.username
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
return JSON.stringify(json);
|
return JSON.stringify(json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#itemtable_filter').append("<span class=\"btn btn-default btn-sm mobile-app-show mobile-app-display\" onclick=\"scancode('#itemtable_filter label input');\"><i class=\"fa fa-barcode fa-fw\"></i></span>");
|
$('#itemtable_filter').append("<span class=\"btn btn-default btn-sm mobile-app-show mobile-app-display\" onclick=\"scancode('#itemtable_filter label input');\"><i class=\"fa fa-barcode fa-fw\"></i></span>");
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
if (search_preload_content !== false) {
|
||||||
|
var searchInput = $("#itemtable_filter label input");
|
||||||
|
$(searchInput).val(search_preload_content);
|
||||||
|
$(searchInput).trigger("input");
|
||||||
|
$(searchInput).trigger("change");
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue