SearchBuilder String "Subtype"
SearchBuilder String "Subtype"
Description of problem:
I would like to update the SearchBuilder conditions for one column, changing the names of those conditions and removing the other conditions. I defined the column (in relevant part) this way:
{
data: 'cycle',
type: 'string',
searchBuilderType: 'cycle'
},
When I create a custom condition using this to change only the names:
cycle: {
'contains': {
conditionName: 'Includes'
},
'!contains': {
conditionName: 'Does Not Include'
}
},
This removes the extra conditions and changes the titles of these, but when I select either option, there is no input box allowing me to specify what to search for.
If, on the other hand, I leave the searchBuilderType alone on the column definition and change cycle in the condition to string, the name is changed on all the string columns in my dataset, and the other options are still there. I can remove those by adding lines like '='=null, but that doesn't accomplish my end goal.
My question is this: do I have to redefine init, inputValue, isInputValid, and search here (digging through the source and copying is not as straightforward as I'd hoped) because I only want this change to apply to a single column? Can I somehow define cycle as a subtype of string for this purpose?
This question has an accepted answers - jump to answer
Answers
Yes. At the moment
containsis just an object withconditionNameand SearchBuilder doesn't fallback to the string option (or anything else) if it isn't found in the given object (although that is a good idea, I might implement that when I get around to rewriting SeachBuilder).So you can't define a subtype. However, it is fairly easy to just copy the options across:
Allan
Thank you! I feel very silly now, as I had
instead of
and thought I was going to have to copy a lot more code over!
Hah - yes, that would be scary! I think that is an area which can definitely be improved. I've made a note of it for when I give SearchBuilder an overhaul.
Allan