Can different combos use a same store with different params? - combobox

In a form, I have two combos, one is named "sales", the other is named "business".
I want Both of them get data from a store "Users" but get different options to be selected.
If I set the two combos with the same "store" property
store: 'Users'
and use "beforeselect" event to pass different params to the store, then when the store changes, it will effect the two combos at the same time.
How can I do this? Two stores?

Related

How to manage states of a shared component where we want to retain the states based on the place the component is being used?

For example: let's say we have a table component used on multiple pages or in a page multiple times. Now, we want to maintain the selected items from the table for each table and highlight them.
So, currently, I am using an object to store the selected items based on the place it's being used:
{
place1: {selectedItemId1: selectedItem1, selectedItemId2: selectedItem2},
place2: {selectedItemId1: selectedItem1, selectedItemId2: selectedItem2},
place3: {selectedItemId1: selectedItem1, selectedItemId2: selectedItem2}
}
Please let me know if you've any other better solution.

How to pass all field values from one view to another by a single object?

I have two views 1.UserInfo 2.EditUserInfo
In view UserInfo there are lots of filed on the view
I want to pass that values to EditUserInfo view using a single object
Is there any in build option in Ext JS to pass all field values from one view to another using single view-object
If your fields are in a formpanel (they better be), the easiest would be to use formpanel.getValues() and formpanel.getForm().setValues().

Drupal Geofield - Include map along with with fields in a view

I want to have a single proximity filter that filters both articles and markers on the map in one hit.
At the moment users have to fill in two forms to keep the map in sync with the articles. This done by two separate views because I can't include fields and a map in the same view.
How can I include a geofield map and fields in one view and have both filtered by a single exposed form?
I can't include fields and a map in the same view.
This is not true, you can use Views Attachments display! So below a map you can have a group of other results such as a list, table etc with the same exposed filters, arguments etc.

Add a "permanent" filter to a store, until I manually call clearFilter

I'm using a store to fetch the specializations of all hikers (so hiker has many specializations). However, I have a detail window where this specializations are added/removed/shown ony for currently selected hiker (yea, it's a detail window).
My problem here is that my store fetch data for all hikers, but I want it to show, when detailed window is up, only data for given hiker. Notice also that I'm showing data in data-grid, so the user possibly can add filters and I noticed that if I add a filter with store.filter({...}) and user add a filter with data-grid, my filters are removed (so basically they are useless.
Which approach should I use? Do you have any suggestion? I were thinking about 1 store for each hiker, but I don't like this solution.
Edit 1:
I also noticed that I can't create a filter in the same way as data-grid builds them:
Ext.create('Ext.util.Filter', {
type: 'numeric',
comparison: 'eq',
field: 'hiker_id',
property: 'hiker_id',
value: me.hiker.get('id'),
root: 'data'
})
Which is boring, because I imnplemented on server side a functionality that parses the grid filters already.
We just give our filters in json format to the store's extra params. And parse that back-end. The extra params stay the same while paging or refreshing the grid.
grid.getStore().getProxy().extraParams = { filter: yourFilter };
-How- are your users doing the filter?
store.filter accepts both arrays and functions, so you can do quite a bit with it, without actually juggling the data on the server. (eg manage an array that is being passed to the filter, test against an object somewhere, or whatever)
Permanent filter? Not so much, but since you can add multiple filters etc, it is relatively trivial to keep track of what filters are in place.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Store-method-filter

extjs4 - merge store into another

I have a data view that renders a store of data.
Once in a while the user may opt in to add more items through different sources.
When that happens, i create a new store and loop through the result and add them to the primary data view store.
Is there a better way to merge two stores? or append loaded data to a store rather than refreshing it entirely?
Check out the loadRecords method of Ext.data.Store
Loads an array of model instances into the store, fires the
datachanged event. This should only usually be called internally when
loading from the Proxy, when adding records manually use add instead
Parameters
records : Ext.data.Model[] The array of records to load
options : Object {addRecords: true} to add these records to the
existing records, false to remove the Store's existing records first

Resources