In the new version, filters with check boxes no longer work on the browser screen. Has anything changed compared to the previous version?
No error is reported in nuDebug.
Thank you.
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 a Browse Screen With a Checkbox
-
- Posts: 6
- Joined: Wed Jan 01, 2020 6:43 pm
Filter a Browse Screen With a Checkbox
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Filter a Browse Screen With a Checkbox
This code works for me:
Code: Select all
if (nuFormType() == 'browse') {
custAddActionCheckbox("filterSomething", "Some Filter Text", "custSetCheckBoxFilter(this, '$id')", 5);
}
function custAddActionCheckbox(id, text, func, s) {
var spaces = " ".repeat(s);
var chkHtml =
spaces + '<input type="checkbox" value="check" style="padding-left:100px;" id="check' + id + '" onclick = "' +
func.replace('$id', id) + '"/><label for="check' + id + '">' + nuTranslate(text) + '</label> ';
$('#nuActionHolder').append(chkHtml);
$('#check' + id).attr('checked', nuGetProperty(id) === 'true');
}
function custSetCheckBoxFilter(chk, id) {
nuSetProperty(id, $(chk).is(':checked').toString());
nuSearchAction(1);
}
-
- Posts: 6
- Joined: Wed Jan 01, 2020 6:43 pm
Re: Filter a Browse Screen With a Checkbox
Thanks for the reply,
before I used
and it worked in the previous version,
now I have modified the script as you suggested and it also works in the new version.
before I used
Code: Select all
// inizio: elimina filtro operatore su browser
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);
}
function SetOperatoreFilter(chk)
{
nuSetProperty('OperatoreFilter', $(chk).is(':checked'));
nuSearchAction(1);
}
if (nuFormType() == 'browse')
{
// valorizza nome utente
nuSetProperty('nomeUtente', getUserName());
var add = ' <label for = "nomeUtente">' + nuTranslate("Operator Name") + ' </label><input type = "text" id = "nomeUtente" value = "' + nuGetProperty('nomeUtente') + '" readonly/>';
$('#nuActionHolder').append(add);
$('label[for = nomeUtente]').css('position', 'relative');
nuAddActionCheckbox("OperatoreFilter", "Exclude other users", "SetOperatoreFilter(this)");
$('label[for = checkOperatoreFilter]').css('position', 'relative');
$('#checkOperatoreFilter').attr('checked', nuGetProperty('OperatoreFilter'));
}
// fine: elimina filtro operatore su browser
now I have modified the script as you suggested and it also works in the new version.
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Filter a Browse Screen With a Checkbox
Something must have changed recently.
Before it was possible to set a boolean value with nuSetProperty() and use that Hash Cookie in a browse sql:
In the current version, the Hash cookie is empty, that's why I converted the boolean to a string with .toString() to make it work again:
Before it was possible to set a boolean value with nuSetProperty() and use that Hash Cookie in a browse sql:
Code: Select all
nuSetProperty('OperatoreFilter', $(chk).is(':checked'));
Code: Select all
nuSetProperty(id, $(chk).is(':checked').toString());