How can I have a searchable ReactSelect component which displays/switches values based on the input value? - react-select

I have a dropdown that I have implemented using ReactSelect. It is searchable. But when I search, it queries for any value with the input string. Rather, I need a startswtih filter. If I type A, it should first go to the first filtered value that starts with A.
I tried using a filter on the handler for 'onInputChange' but it is not getting displayed on the dropdown

Related

Getting the selected filter from the multiselect column with yadcf

Hi I am using yadcf with datatables which allows me to do multiselect column filtering and that makes me happy. Now I want to display my selected values in the filter as tags to a separate search bar. How do I grab the selected values in my multiselect column filter? Thanks.
You should use the exGetColumnFilterVal method, like this:
yadcf.exGetColumnFilterVal(oTable,1);
See relevant docs (from yadcf js file)
* exGetColumnFilterVal
Description: Allows to retrieve column current filtered value (support ALL filter types!!!)
Arguments: table_arg: (variable of the datatable),
column number: column number from which we want the value
Usage example: yadcf.exGetColumnFilterVal(oTable,1);
Return value: String (for simple filter) / Object (for range filter) with from and to properties / Array of strings for multi_select filter

Report Builder 3.0: How do I specify the dataset for this textbox?

I made a simple query to return 1 field. One of the fields is the user's input.
Item (input)
Description (return value)
I now want to use the returned value in a simple textbox on the report, but it's giving me a scope error. Makes sense, but how do I tell the textbox which dataset to look in (there are multiple datasets)?
If you right mouse click on the text box you can create a placeholder.
You can then specify the value of this placeholder to be the required value from the dataset.

BIRT result set values in specific cells

My query returns location_cd(string) and item_count(int). I only need certain rows from the result however and I need them to display in specific places in my layout so I don't think the table solution is going to work. Can I determine where I place the value for a particular row of the result set?
I am using a grid to display values for a number of fields. I cannot seem to be able to get the values from the results to show. The grid is bound to the result set. I even tried binding the cells to the result set but that didn't work either.
I checked in the query editor and there is a result set shown in the Preview so I know the query works. The complete and correct result set shows if I put a table on the page.
I tried inserting a Dynamic Text or Data object in a cell and used the expression:
dataSetRow["location_cd"]=="3SD"?dataSetRow["item_count"]:""
This returns a blank and does not seem to evaluate. I tested it with :
dataSetRow["location_cd"]=="3SD"?dataSetRow["item_count"]:"BLANK"
and got 'BLANK' to appear in that cell.
dataSetRow["location_cd"] and dataSetRow["item_count"] will display the location_cd and item_count from the first row of the result set. row.outer[] did the same thing. Obviously I am just hacking at this report at this point.
A co-worker suggested that she uses a JAVA if-statement in places like this but I could not get that to work either.
Any ideas or suggestions that will get me on the right road??
Thanks
An elegant option would be to use a HashMap storing the result of the dataset.
Declare a report variable named "values", with a new hashmap as default value (see image below)
Fill values in the onFetch script of the dataset: vars["values"].put(row["location_cd"],row["item_count"]);
Insert new data elements at any place of the report with expressions such: vars["values"].get("myFavoriteLocationCD");
Though it is important to note the dataset should be triggered by the report before these data elements.
The particular row you want to display you specify in a "Text" field inside your grid. Just drag and drop a "Text" field inside your grid. If you bound the fields you want to display to your grid, the "Text" field inside the grid inherits the bindings of its parent (the grid), so you can access the bindings automatically in the "Text" field.
You could try following steps, maybe that works.
Don't use "Dynamic Text" field, instead use a regular "Text" field
Ensure the fields of your query which you use, are bound to the grid (you sayed you already did)
Open the "Text" field
Change preselected pull-down entry "Auto" into "HTML"
Change preselected pull-down entry "Formatting" into "Dynamic Text"
Wrap your code in <value-of format="HTML"> your code goes here... </value-of>
Note: You should check in the "Expression Builder" of your "Text" field if you are able to access the fields you bound to the grid. If they are not available sth. went wrong with your binding. Avoid binding query records to cells this will drive you crazy.
If you want to display a list, ensure you didn't set a constant height in the row of your grid. Set the height to 100% than the row takes its height dynamically.
What about the idea to optimize your query, that only get the results you want are displayed, than you don’t need to filter them with java script? If you don’t need the filtered results in another place this would be the cleaner solution in my opinion.

Hidden model-bound values in view not getting passed to controller when populated manually

I'm using the KendoUI AutoComplete for a number of look-ups on a custom editor template that pop-ups off a grid for new rows and edits. The Kendo AutoComplete does have a DataTextField property and does not DataValueField property like a DropDownList would. So, I found I am able to get the Value of the selected item in the AutoComplete with a little Javascript and iterrogating the "dataItem" object in the select handler. And I put that value into a "SelectedID" field declared with #Html.HiddenFor(model => model.SelectedID) on the select event.
Now, when I do a save from the view and have a break point on my controller action that captures the incoming model, all those ID values where i set the value manually are empty/null/blank. I've checked the DO and have done "console.log" to read out the values of the hidden fields before the post and the values are populated. I've changed the datatypes (strings, guids, etc) and I've changed the Html Helper type as well from a HiddenFor to a EditorFor just to make sure the values are indeed there.
So i think this is a problem when the values of an element that are part of the model are populated in a "manual" fashion. The text of the AutoCompletes comes through if I bind that to a field on the model as well. Any date fields, checkboxes and free-form text fields come through as well. It seems it is just values of model bound fields where I set the values manually that don't make it over the "wire". Any thoughts? Solutions? I know the Selected Value is accessible ... it's just a matter of properly getting it into the "HiddenFor" fields.

dijit.form.Combobox show label Instead of value

I've a dijit.form.Combobox field which uses a ItemFileReadStore to pull Its data.
Teh ItemFileReadStore has two attribute per Item value which will be used for form submission , generally Unique Integers and label which is Human Understandable String.
In ComboBox HTML I've done searchAttr="value" labelAttr="label"
When the ComboBox Shows the list it uses teh label Attribute.
But When the User selects one of the Item it shows the value of that Item.
What I want is , The value Attribute will Still be used for Form Submission. But the User will always see the label in the combobox Control.
alt text http://img822.imageshack.us/img822/6660/dijitcombo.jpg
e.g. I Want to Show The Label for value 3 (Admin) instead of 3
Use FilteringSelect instead of Combobox.
Note: ComboBox only has a single value that matches what is displayed while FilteringSelect incorporates a hidden value that corresponds to the displayed value.
I have tried the following.
var cmbObject = Registry.byId('combo dojo id'); var id =
cmbObject.item.<Code Property>;
You should check if item is null.