Hi all,
I have a requirement where I would like to have a checkbox to filter rows.
Checkbox status:
Checked -> show all rows with a date (column End Date)
Unchecked -> show all rows (with End date or not)
How do I refresh the Browse Form and apply the filter?
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Filter rows
-
- Posts: 92
- Joined: Mon May 14, 2018 3:26 pm
Re: Filter rows
marc,
What you are wanting to do is not the way nuBuilder does things.
I suggest you create another column that contains something like 'HasDate' or 'NoDate' - based on the date column.
That way you can filter using the normal search feature (without any extra programming).
Steven
What you are wanting to do is not the way nuBuilder does things.
I suggest you create another column that contains something like 'HasDate' or 'NoDate' - based on the date column.
That way you can filter using the normal search feature (without any extra programming).
Steven
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: Filter rows
Hi,
If you are still looking for a solution...
I have a browse form which initially only displays the data as of today. By clicking the checkbox "Show All" all data will be displayed. You may adapt it to your needs.
Short video: https://vimeo.com/278120734
Browse SQL:
Add this Javascript to your Form:
If you are still looking for a solution...
I have a browse form which initially only displays the data as of today. By clicking the checkbox "Show All" all data will be displayed. You may adapt it to your needs.
Short video: https://vimeo.com/278120734
Browse SQL:
Code: Select all
SELECT
*
FROM
my_table
WHERE
(
(
LOCATE('#', '#custDateFilter#') = 1
OR '#custDateFilter#' = 'false'
)
AND my_date >= CURDATE()
)
OR (
LOCATE('#', '#custDateFilter#') <> 1
and '#custDateFilter#' <> 'false'
)
ORDER BY
my_date
Code: Select all
function nuAddActionCheckbox(i, v, f){
var chk = ' <label for="check' + i + '">'+ nuTranslate(v) +'</label><input type="checkbox" value="check" id="check' + i + '" onclick = "'+f+'"/> ';
$('#nuActionHolder').append(chk);
}
if (nuFormType() == 'browse') {
nuAddActionCheckbox("custDateFilter", "Show All", "custSetDateFilter(this)");
$('#nuBrowseFooter').after($('#checkcustDateFilter'));
$('#nuBrowseFooter').after($('label[for=checkcustDateFilter]'));
$('label[for=checkcustDateFilter]').css('position', 'relative');
$('#checkcustDateFilter').attr('checked', nuGetProperty('custDateFilter'));
}
function custSetDateFilter(chk) {
nuSetProperty('custDateFilter', $(chk).is(':checked'));
nuSearchAction(1);
}
You do not have the required permissions to view the files attached to this post.
-
- Posts: 92
- Joined: Mon May 14, 2018 3:26 pm