Remove search box with bFilter still set to True in DataTable - datatables

I need to apply custom filtering function in my datatable. For this, I need to set "bFilter": true. But I don't need search box. How can I do that?
var holiday_filter = $('#holiday_table').DataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": false,
"bInfo": false,
"order": [[0, 'desc']],
//"aLengthMenu": [5, 10, 20, 30],
'iDisplayLength': 4,
"bAutoWidth": false
});

Use dom option (default value lfrtip) without f which represents filtering input.
For example:
var holiday_filter = $('#holiday_table').DataTable({
// ... skipped ...
'dom': 'lrtip'
});

Related

SQL parse a dictionary of true/false to list of true values

I have a column in the form of a dictionary:
{"black": false, "white": true, "green": true, "blue": false, "red": true, "yellow": false, "pink": false, "orange": true}
I want to turn it into a list of keys that has a true value-
white, green, red, orange
Any idea whaat's the simplest way to do this?
Preferably without including all the colors in the query itself, as they may be more added in the future.
It's Postgres SQL if it matters.
Thank you
JSON_EACH_TEXT returns key value pairs. Demo
create table foo (
id int,
col json
);
insert into foo values
(1, '{"black": false, "white": true, "green": true, "blue": false, "red": true, "yellow": false, "pink": false, "orange": true}');
select foo.id, t.key
from foo
join json_each_text(col) t on value = 'true'
You can turn the key/value pairs into rows, then aggregate back those where the value is true:
select string_agg(color, ', ')
from json_each_text('{"black": false, "white": true, "green": true, "blue": false, "red": true, "yellow": false, "pink": false, "orange": true}') as j(color,v)
where j.v = 'true';

How to change text to value in data tables

Hi I am trying to export my values into excel but some of them are converting to text I don't know why I am passing integers but the exported excel file is converting them into integer. Is there any way to convert them into integer ?
table = $('#OriTable').dataTable({
responsive: false,
orderClasses: false,
aaData: json["data"],
deferRender: true,
stateSave: true,
bPaginate: false,
searching: false,
aaSorting: false,
dom: 'Bfrtip',
buttons: [
'copyHtml5',
'excelHtml5',
'csvHtml5',
'pdfHtml5'
]
});
Thanks.
Update
Attached the image below:
https://i.stack.imgur.com/PnDYR.png
data examples:
[1, "Finca", 6.371, 2378167.48, 0.13]
[2, "Diner", 5.573, 75643343.6, 4.27]

yadcf not sorting dropdown list properly

I have tried every option I can think of in configuring both DataTables (capital D) and yadcf but cannot seem to get the select drop down list to list in case-insensitive order.
Setup:
var dTable=$('#bTable').DataTable({
"traditional": false,
"pageLength": 1000,
"jQueryUI": true,
"stateSave": true,
"stateDuration": 60 * 60 * 24,
"processing": true,
"stateLoadParams": function (settings, data) {
lastSearch=data.search.search;
},
"ordering": true,
"processing": true,
"paging": false,
"info": false,
"autoWidth": false,
})
yadcf.init(dTable,[
{column_number : 3, column_data_type: "text", filter_match_mode: "exact", sort_as: "alphaNum", filter_container_id: "hs_clu", filter_reset_button_text: false, style_class: "select-style", filter_default_label: "All"},
],
{ cumulative_filtering: true }
);
When I click on the column header the column data is sorted properly as:
nbmps01
nbmps02
nbmps800
Network-1
Network-2
Network-3
NTPROV
NTSYM
NTWKTRANS
NVAM-CXMT
My dropdown select list is in this order and doesn't seem to be proper:
NTPROV
NTSYM
NTWKTRANS
NVAM-CXMT
Network-1
Network-2
Network-3
nbmps01
nbmps02
nbmps800
I have am at my wits end on this after 2 days of fiddling with it. Does anyone out there have any ideas and are willing to share.
Any help is very much appreciated.
I have improved the alpha numeric sorting in yadcf 0.9.1.beta.5 , now it works as expected.
use sort_as: "alphaNum"
Here is a working jsfiddle link

How to adjust the position of several axes in one chart?

I create a line chart using dojo. Recently, I have been applying multiple axis on the chart. But there was a problem here. It is applied to multiple axes in one place I have raised the issue of overlapping tick value. and do not change the properties of leftBottom, is there a way to adjust the shaft position? For example, x: 10, y: 20?
my code
var axisXRef = {labels : labelsample, titleOrientation : "away", stroke : {}, natural : true};
var axisYRef = {vertical : true, stroke : {}};
var chart = new Chart("chartNode");
chart.addPlot("lines", { type: Lines, tension: 3 ,min:0});
chart.addPlot("stacklines", { type: StackedLines, tension: 3 ,hAxis:"x",vAxis:"y1"});
chart.addPlot("areas", { type: Areas, tension: 3,hAxis:"x",vAxis:"y2" });
chart.custom.axisX = lang.clone(axisXRef);
chart.custom.axisY = lang.clone(axisYRef);
chart.addAxis("x", chart.custom.axisX);
chart.addAxis("y", chart.custom.axisY);
chart.addAxis("y1", {
vertical: true,
min : 50,
max:70,
leftBottom:true,
majorLabels: true, majorTicks: true, majorTick: {color:"red",length:50},
minorLabels: true, minorTicks:true, minorTick:{color:"red",length:50},
microTicks: true, microTick:{color:"red",length:50},
fixUpper: "major",
fixLower:"minor"
});
chart.addAxis("y2", {
vertical: true,
min : 0,
max:49,
leftBottom:true,
majorLabels: true, majorTicks: true, majorTick: {color:"blue",length:25},
minorLabels: true, minorTicks:true, minorTick:{color:"blue",length:25},
microTicks: true, microTick:{color:"blue",length:25},
fixUpper: "major",
fixLower:"minor"
});
Unfortunately Dojo charting only supports two axis per direction both axis being on different side of the chart. In other words you can't have two axis both on the left side of the chart. You have to have one right side using leftBottom: false property.

Check box "ticked" on page 1 is reflected in page 2 in EnhancedGrid

I have a enhancedgrid and used on two pages. When check box (component of data enhanced grid) is checked on page1, the equivalent row(s) on pg 2 are then ticked. My enhancedgrid code is
grid = new dojox.grid.EnhancedGrid({
loadingMessage:"Please wait",
store:newStore,
structure:layoutQL,
autoWidth:false,
autoHeight:true,
columnReordering:false,
rowsPerPage:3,
indirectSelection: true,
//noDataMessage:"No transactions have been processed for posting.",
//selectionMode:'single',
plugins: {
pagination: {
description: true,
sizeSwitch: false,
pageStepper: true,
gotoButton: true,
/*page step to be displayed*/
maxPageStep: 6,
/*position of the pagination bar*/
position: "bottom",
indirectSelection: true
},
filter : {
// Show the closeFilterbarButton at the filter bar
closeFilterbarButton: true,
// Set the maximum rule count to 5
ruleCount: 5,
// Set the name of the items
itemsName: "records"
}
}
I am using EnhancedDataGrid as in dojo framework. Any help will be appreciated.
Try "grid.selection.deselectAll()" when you move from one page to the next.