I have 2 comboboxes. The first selects a category, the second selects the sub category. Both categories are stored in one store with fields: id, parentId, label. Filtering the store isn't working since both comboboxes are bound to the same store.
How can I link the comboboxes? How can I filter the list of the second combobox?
Instead of referring to the same store use Ext.create() to create a new instance of the same store for the second combo box. Use select or change listeners on comboboxes to trigger filtering from one to the other.
EDIT:
Here is an example of such a beast :) http://extjs.wima.co.uk/example/1
This is not mine but sounds exactly what you are doing. Please note the way the stores are setup for each combo box. The first Combo CREATES a new store with the new operator - although this is not the best practice, it will work. The best practice is just to use Ext.create(..).
The second Combo refers to an existing store. In your case since you are reusing the same store definition you want to use Ext.create(...) on both Combos.
For more reference on best practices of class system read this guide: http://docs.sencha.com/ext-js/4-0/#!/guide/class_system
friend.....try filter on the store.
Related
I'm working in Microsoft Dynamics 365 and have a problem with the Custom Filters for Lookup Fields.
Right now, when a value is selected for one Lookup Field, this calls some JavaScript that builds a CustomFilter for another Lookup field. This works exactly as it should. The problem though is that occasionally there is a value that was already entered in this filtered Lookup that is no longer relevant, and I'm trying to figure out how best to handle this.
Example:
If Option A is selected, values 1, 2, 3, 4 will appear in the filtered lookup.
If Option B is selected, values 3, 4, 5, 6 will appear in the filtered lookup.
The client is requiring that the filtered lookup not be blanked out if the entered value in the filtered lookup field is still relevant. In the case of the above example, that would be values 3 and 4, but these exact over-lapping values could change down the road so I'm not about to hard-code the solution.
I'm not seeing any quick way to accomplish this. I would rather not perform a separate search based on the filter as that will be extremely time consuming for me to put together given how things have been built up to this point. Also, Dynamics seems to resolve the selection based on pre-filtered criteria, which doesn't help.
Any thoughts or idea?
I gave a second thought about this. You have 3 options to try.
store the selected value from lookup2 on form load/on change of lookup2 in a local variable, then on change of lookup1 fetch the available options based on prefilter query & cross check with local variable. If it’s still a relevant option, then set the lookup2 with local variable value
we can try to stop clearing the lookup2 , not quite sure if it’s possible. Like hooking the onchange of lookup1 & preventDefault when the previously selected option is still a relevant option
convince the client & train the end user to choose lookup2 again as in this is not worth the effort
I have a page with multiple text fields and select lists with the list of values. What I want to do is defining a dynamic action on one of the select lists that display numbers and returns same numbers and according to the selected number, I want to create or duplicate another select list in an amount of selected number. Then, after the end-user finish his work, I want to be able to take the selected values of select lists that are created within the dynamic action within the on-submit process.
Example:
In short, I want to create a dynamic action that duplicates the instructor list as many as the selected number of the number of sections list. How can I accomplish this?
If I understood what you are saying, you'd rather switch to a tabular form (or interactive grid, depending on Apex version you use). Using it, you can "Add row" as many times as you want (which would be your "Number of sections") and use the same LoV (i.e. Select List) in every row.
As far as I know (which really isn't that much), Apex isn't capable of doing that "as is". Maybe you can accomplish it the way you want it using some other techniques (blindly guessing & mentioning: JavaScript, Ajax, jQuery or whatever you might need).
I have a dgrid with inputs. My dgrid is in edit mode so users can add rows, edit rows and sort rows. When I look at my collection, it looks like
id: "1"
COLUMN1: "INPUT TYPE="text"...."
COLUMN2: "INPUT TYPE="text"...."
Note: I could not put the greater than and less than above with describing the inputs.
and so on. When I make a change on screen, for one of the inputs, the collection is not updated. So, when I enter a new row or sort the dgrid, all the entered data refreshes back to its original state. I know the reason is because the collection is not updated. Is it possible to update the collection or do I have to write my own code to do so? Please note, I am using a dgrid and NOT an onDemand grid.
Thanks for your help in advance.
Please add some code on how you are initializing your collection and what all mixins are being used for it. As far as I can understand your problem, you need to add the Trackable mixin in your collection. Read its documentation here.
From the documentation:
We can add support for tracking the position of updates by using the Trackable mixin. With the Trackable mixin added to a store, we can call the store's track method to get a collection that includes index information in its delete, add, and update events.
This might be of your help.
I am using extjs 4.1 data store. I have attached the store to three grids.
When user selects a record on gridOne, I update addedOnGridOne property to true. Similarly when user add a record on GridTwo, I update addedOnGridTwo property to true.
Now I have a added a checkbox, when this checkbox is checked, I need to reset addedOnGridOne & addedOnGridTwo properties available in the store & while this checkbox is checked, i need to separately maintain addedOnGridOne & addedOnGridTwo properties.
What I want is: After the store is loaded for the first time, I want to create two copies of data available in store.
If the checkbox is chedked, I will load the first copy of data and if user is on tab two I will load second copy of data.
What options are available to me here? is it a good idea. Is there any better approach? Please suggest
One store for more grids almost always leads to troubles as sorting, filtering and editing influences all three grids. If you need three grids working with the same data you could have three separate store instances loaded with the same data.
I want to create a combobox with a hierarchical list of items. I need to be able to select the parent items as well as the children individually. I also need to be able to provide typeahead capabilities for this combobox.
For example, I want to make a combobox with this data in JS:
Canada
--Ontario
--Quebec
USA
--Massachusetts
--Ohio
--Texas
From this dropdown I want to be able to select any of the provinces/states individually. I also want to be able to select "Canada" without selecting it's children.
I've tried Select2 and have been digging around JQuery UI to see if it is possible, but so far I can't quite achieve the behaviour I need. I'm writing this page using bootstrap, but the given typeahead in boostrap doesn't seem to work with comboboxes at all (that I can see).
You can use Chosen javascript plugin to achieve this.
http://harvesthq.github.com/chosen/
You can store custom JS objects for each typeahead result so that it can displays and store more than just a string (a type, or ID for example). Using that would let you have different logic for country vs province/state. Here's an example of doing so:
https://github.com/twbs/bootstrap/pull/3682
So in the updater function, you could have logic based on your custom object to determine whether it's a parent or child that was clicked.
As far as making the parent look different than the child, I haven't used it myself, but there is a templating system in bootstrap. Check out this link for an example:
https://github.com/twbs/bootstrap/issues/2441
You could likely use this to differentiate the parent and child look and feel.