Page 1 of 1
Exclude column from Search
Posted: Sun Jan 21, 2018 8:03 am
by toms
Hi,
To exclude a column from being part of a Search, I can use this piece of code in the Browse Form's Javascript field in nuBuilderPro.
Code: Select all
$("[id='nusearch_9'").prop('checked', false);
How can untick a checkbox in nuBuilderForte (by code)?
Re: Exclude column from Search
Posted: Sun Jan 21, 2018 9:06 am
by admin
toms,
I'm not sure what you mean.
Have you seen this?
http://wiki.nubuilder.net/nubuilderfort ... le_Columns
Steven
Re: Exclude column from Search
Posted: Sun Jan 21, 2018 9:12 am
by toms
I'd like to have one column excluded (automatically) from the search by default. When a Browse Form is opened, a JavaScript is run to "untick" that column.
Re: Exclude column from Search
Posted: Sun Jan 21, 2018 9:42 am
by admin
toms,
I will add this to the next update but I can't upload it at the moment.
You can try it out though.
Code: Select all
function nuSetNoSearchColumns(a){
var s = nuFORM.getCurrent().nosearch_columns;
a = s.concat(a);
for(var i = 0 ; i < a.length ; i++){
$('#nusort_' + a[i]).addClass('nuNoSearch');
}
nuFORM.setProperty('nosearch_columns', a);
}
Call it from the same place as all the other custom Javascript. On the Form who's Browse Form you want to change.
BTW do you check the email address you registered on the forum?
Steven
Re: Exclude column from Search
Posted: Tue Jan 23, 2018 4:33 pm
by toms
Thanks Steven, it works great!
I combined it with an own function nuGetColumnNumbers() so I can pass the column titles instead of their numbers.
Code: Select all
function nuGetColumnNumbers(columnTitles) {
var a = Array();
var bc = nuFORM.getCurrent();
var col = bc.browse_columns;
for (c = 0; c < col.length; c++) {
var f = col[c].title;
if (columnTitles.indexOf(f) != -1) {
a.push(c);
}
}
return a;
}
function nuSetNoSearchColumns(a){
var s = nuFORM.getCurrent().nosearch_columns;
a = s.concat(a);
for(var i = 0 ; i < a.length ; i++){
$('#nusort_' + a[i]).addClass('nuNoSearch');
}
nuFORM.setProperty('nosearch_columns', a);
}
nuSetNoSearchColumns(nuGetColumnNumbers(['emp_firstname', 'emp_lastname']));
Re: Exclude column from Search
Posted: Tue Jan 23, 2018 5:03 pm
by admin
toms,
It was a good idea.
I would think a lot of people could use it.
I've added it to the wiki...
http://wiki.nubuilder.net/nubuilderfort ... rchColumns
Steven