Aribitrary location match for a Dojo ComboBox - dojo

When ever you type anything in Dojo's ComboBox you get a list of possibilities based on the options that it has set but the matching only happens at the beginning of the string. I was wondering if there is a way to match any position in the option string.
For example if you options are: "Windows", "Linux", "OSX", "AIX", "Solaris" and you type "in" then the options that would show up are "Windows" and "Linux"

Change queryExpr attribute

Related

Conditionally capturing pre-determined text in one field based on multiple choice selection in another field in REDCap

Problem: How can you capture a pre-determined or static text value based on what choice a user makes from a multiple choice menu on a survey?
Example: Suppose you have the following basic setup:
I have four text statements that correspond to options 1-4 (e.g., "Statement corresponding to Option 1", "Statement corresponding to Option 2", etc.). If the user chooses, say, Option 1 from the sample_options field, then I would like to capture the text value of the pre-prepared statement in the option_statement field. The user should not be able to alter the captured text statement (e.g., maybe hide the field using the #HIDDEN action tag).
Attempt: It seemed like this might be a problem that could be resolved with action tags, namely the #DEFAULT one, but I have been unable to do this. I also thought about trying to use a calculated field instead of a text field for option_statement, but calculated fields must return numeric values:
This seems like a problem that should be somewhat straightforward to tackle, but I have been baffled by just how hard it seems to be to simply capture static text in one field based on a user's selection in another field.
If I understand the question, you want to select a text string from a list of (in this case) 4 options, depending on the user selecting a choice from a radio/dropdown?
Probably the easiest method is to use #CALCTEXT (if you are on a sufficiently recent version), which allows you to conditionally populate a text field, i.e.:
#CALCTEXT(
if([sample_options] = 1, "This is the label for option 1",
if([sample_options] = 2, "This is the label for option 2",
if([sample_options] = 3, "This is the label for option 3",
if([sample_options] = 4, "This is the label for option 4", "This is an else value")
)
)
)
)
But if you do not have #CALCTEXT available to you, you can do this with a #DEFAULT, by constructing another radio field (#HIDDEN if you like) on a separate page or instrument (as #DEFAULT needs the value to exist in the database on page load, and so does not work dynamically on the page), with your four labels as the options with the same choice codes as your [sample_choices] field. For example:
1,This is the label for option 1
2,This is the label for option 2
3,This is the label for option 3
4,This is the label for option 4
And annotate it with:
#DEFAULT='[sample_choice]'
Thus if a user selects 3 for [sample_choice] and proceeds to the page or instrument that has the label field, the #DEFAULT tag will automatically select choice 3 from the label field, which can then be stored in the dataset and piped into an email, onto the page, or whatever.

Store as Json Blob or Make Columns?

I am building a "filter component" that displays all available filters for that "product type".
Pretty standard pretty much just think of bestbuy, amazon, craiglist style filter.
Right now I am focusing on how to generate the filter options(not how to handle once a user clicks on a filter option and it must then go off and filter the results down).
So I created a json object that has something like this,
which will create each header section(HardDrive,Ram Size, Number of CPU Cores), what type is it(checkboxes, textboxes),
should the section be opened,
should it have a search box in it.
{
type: "", // this is what type of filter it will be (textbox, checkboxes and etc)
header: "Filter Header",
property: "", // this maps it back to the column name in db used when filter is actually triggered.
hasSearchBox: false, // some filter options are long so search box can be shown.
isOpen: true, // controls if this filter should be in an open or closed state.
for: ["What Products this filter applies to. Some of these filters are common between all products"]
},
Now I need to figure out if I should store the above as is or if I should break it into a column format.
Ie
Filters Tbl
Id
ProductTypeId
type
header
property
hasSearchBox
isOpen
This does make it easier to add a new filter in the future, but I am bit concerned if some new option comes in that might only be for some filters and not others(ie lots of null columns) or if I need a more complex objects in the future(like setting the placeholder name for the textbox).
or if I should store it like this
ProductTypeTable
Id
FilterOptions <--- json from above gets store in here.

Is it possible to use yadcf "ranger_number_slider" in server side processed datatables?

I need some help.
I have a server side processed jquery.datatable. One of the columns is a numeric col with values between 0 and 180.
I would like to filter this column with yadcf ranger_number_slider. I set the yadcf like this:
{
column_number: 14,
filter_type: 'range_number_slider',
filter_container_id: 'external_filter_container_ZZ'
}
But I am faced with some problems:
On the first page of the datatable (paging size is 10, number of entries is roundabout 10.000), the values of this specific column are (accidentally) only from 0 to 30. The ranger_number_slider shown in the div "external_filter_container_ZZ" is as shown below:
Ranger-Number-Slider
As you see in the image, the slider is set from 0 on the left side to 30 on the right side. It seems, that the slider doesn´t get all values from the server side processing for this specific column.
Furthermore: If I try to select some values in the slider, the result in the table is always empty, and the slider disappears!
Is anybody able to give some hints for this behaviour?
Thank you very much in advance.
Best regards
BeSt
Not only that its possible, its available on the showcase page - see here, you must do some reading in the docs / showcase (source on github too) and you will find all the needed docs for that, in short: in addition to your table data that is sent form server to client you must provide yadcf with its data as well - populate the yadcf_data_COL_NUM with the relevant data,
aaData:[["Trident", "Internet Explorer 4.0", "Win 95+", "7/24/2015", "1"],…]
draw:"2"
recordsFiltered:6
recordsTotal:57
yadcf_data_0:[{value: "Trident", label: "Trident Eng'"}, {value: "Tasman", label: "Tasman Eng'"},…]
yadcf_data_1:["Nintendo DS browser", "Netscape Browser 8", "All others", "Lynx", "Mozilla 1.6", "Mozilla 1.5",…]
yadcf_data_2:["N800", "Win 95+ / Mac OS 8.6-9.2", "S60", "KDE 3.5", "Win XP SP2+", "KDE 3.3", "OSX.3", "KDE 3.1",…]
yadcf_data_4:["134", "0"] <- this is for range slider filter tips
From showcase docs
//In case that you want to populate your select / auto_complete
filters with values //you have to add to your current JSON the
following attributes yadcf_data_0 / yadcf_data_1 / etc' //where each
attribute contains a list of strings //For example:
//"yadcf_data_0":["KHTML","Webkit","Trident","Misc","Other
browsers","Tasman","Presto","Gecko"],

dataTables search bar returns incorrect results

When using the searchbar to search for a product, I also get results that do not contain the string I input.
For example, inputting "70" shows the following results : HeatMaster 120, HeatMaster 70, HeatMaster 85.
This is because the rows containing this data have another column, numerical, which also contains "70" (e.g: 170); is there a way I can force this plugin to consider only one specified column when searching ? Or a plugin for this ?
Doing a little test-driven research, I found out that the default behavior of the search box is to search all the fields and return all the rows that contain the input string; to search on only a specific column, I used the columnFilter add-on for jQuery dataTables.
http://jquery-datatables-column-filter.googlecode.com/svn/trunk/default.html

Setting flex/width of columns in rallygrid with columncfgs

If you specify the columnCfgs for a rallygrid using the string representation, you get some nice built in functionality for different columns - e.g. the FormattedID column has a link to the item when it is rendered. However, some of the fields have a default flex that makes them way longer than necessary (mostly the name) which makes the grid look a lot different than I want it to.
You can specify the name column as
{text: 'Name', dataIndex:'Name', flex: 1},
but is there a way to specify flex for columns that you declare using the format:
'Name'
?
This is a weirdness with the grid that we'd like to fix before the GA of SDK 2. In the meantime you can simply do the same thing the grid is doing to build those preconfigured columns:
var nameColumnConfig = Rally.ui.grid.FieldColumnFactory.getColumnConfigFromField(
model.getField('Name'), model);
nameColumnConfig.flex = 1;
Then simply pass that into the grid the same as you would the object literal above.