[CLOSED] TagField clears store filter after select.

  1. #1

    [CLOSED] TagField clears store filter after select.

    Hello.

    TagField appears to be clearing the stores filters after a user makes a section.
    This makes sense since since, I'm assuming, it uses filters when typing in the TagField to narrow down your selection options.
    However, this store already has a filter.
    After the selection is made, ext clears all filters, not just the filter it used to narrow the selections when typing.
    And, there is no trigger for after the filters are cleared so I can re-apply it.

    Any ideas or suggestions?

    The TagField:
    <ext:TagField runat="server" StoreID="RecipientsStore" QueryMode="Local" DisplayField="Email" ValueField="Email" SelectOnTab="false" HideSelected="true">
    	<Listeners>
    		<BeforeQuery Handler="#{RecipientsStore}.filter({property:'EnterpriseCD', value:#{EnterpriseComboBox}.value, id:'EnterpriseCD'});"></BeforeQuery>
    	</Listeners>
    </ext:TagField>
    This is the EXT JS code, the "me.store.clearFilter();" line is giving the headache.
    onItemSelect : function (sm, record) {
    	var me = this;
    
    	if (me.ignoreSelection || !me.isExpanded) {
    		return;
    	}
    
    	me.inputEl.dom.value = "";
    		
    	if (!me.createNewOnSelect) {
    		me.inputEl.dom.value = record.get(me.displayField);
    		if (me.collapseOnSelect !== false) {
    			me.collapse();
    		}
    
    		me.ignoreSelection++;
    		sm.deselect(record);
    		me.ignoreSelection--;
    	}
    	else {
    		me.addTagToInput(record);
    		
    		if (me.collapseOnSelect === true) {
    			me.collapse();
    		}
    	}
    
    	me.fireEvent("select", me, record);
    	me.store.clearFilter();
    	me.inputEl.focus();
    },
    I could possibly fire on the firing on the select event with a 1ms delay, but this seems like a band-aid.
    <ext:TagField runat="server" StoreID="RecipientsStore" QueryMode="Local" DisplayField="Email" ValueField="Email" SelectOnTab="false" HideSelected="true">
    	<Listeners>
    		<BeforeQuery Handler="#{RecipientsStore}.filter({property:'EnterpriseCD', value:#{EnterpriseComboBox}.value, id:'EnterpriseCD'});"></BeforeQuery>
    		<Select Delay="1" Handler="#{RecipientsStore}.filter({property:'EnterpriseCD', value:#{EnterpriseComboBox}.value, id:'EnterpriseCD'});"></Select>
    	</Listeners>
    </ext:TagField>
    Thanks.
    Last edited by CarlMGregory; Jun 17, 2016 at 10:32 PM.
  2. #2
    Hello @CarlMGregory,

    Please provide a simplified code sample demonstrating how to reproduce the issue.

    The code sample you provide should include only the minimum amount of code required to reproduce the issue. Code unrelated to the issue is to be removed. Anyone should be able to copy + paste your sample into a local Visual Studio test project and run without having to make modifications.

    Tips for creating simplified code samples

    If Exceptions or syntax errors are thrown when testing your code sample, we'll let you know so you can revise your original sample. Then we'll review again with the updated sample.

    When posting your code samples in the forums, please paste that sample within [CODE] tags. The [CODE] tags will add formatting and syntax highlighting to your sample.

    The following two forum posts provide many excellent tips for posting in the forums:

    1. More Information Required
    2. Forum Guidelines
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi, thanks for taking the time to respond.

    The bulk of the code is above: http://forums.ext.net/showthread.php...115#post279115

    Here is an example store you can use
    var dataTable = new DataTable();
    dataTable.Columns.Add("Email");
    dataTable.Columns.Add("EnterpriseCD");
    dataTable.Rows.Add("ABC123", "test@abc123.com");
    dataTable.Rows.Add("ABC123", "test2@abc123.com");
    dataTable.Rows.Add("ABC123", "test3@abc123.com");
    dataTable.Rows.Add("EXT", "fabricio.murta@ext.net");
    As my first post already outlines, step one, filter the store by something. In my case, as an example, filter EnterpriseCD by "ABC123". Now, trigger the drop down list for the TagField, you will see only 3 entries; test@abc123.com, test2@abc123.com, and test3@abc123.com. Click on any of those, such as the first, test@abc123.com. Now you will see the list change to test2@abc123.com, test3@abc123.com, and fabricio.murta@ext.net. (side note, test@abc123.com, what we clicked on, no longer is in the list because we are doing HideSelected="true", but this has nothing to do with the issue we are discussing, set it to false and that particular entry will not disappear, but still "fabricio.murta@ext.net" will appear, and that's the problem) If you open up the javascript console (f12) and query the filters on the store, the filter that is filtering it by EnterpriseCD is gone, there are no filters after a selection is made. And, again as I said above, this is because the 'onItemSelect''s second to last line clears all filters.

    Here is a video showing the issue in action: https://db.tt/8nchm29l

    Does that help, fabricio.murta?


    Thanks.
    Last edited by CarlMGregory; Jun 20, 2016 at 2:47 PM.
  4. #4
    Hello @CarlMGregory!

    Indeed that video helps a lot, but we are still helpless without being able to actually run the code in our side, reproducing the issue as you show in the video, so we can fiddle in the guts of the JavaScript to give you a solution to the problem.

    Simplifying the problem down to a few-lines-long single-code test case (and simple model+view+controller triple in MVC) is essential for us to be able to focus on the problem and help you out with it.

    If you take your time over the threads linked above you'd understand. If you are using webforms, I am pretty sure you can simplify your example down to something even simpler than the GridFilters - Local example.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 8
    Last Post: Jun 05, 2016, 7:10 PM
  2. [CLOSED] TagField : How to allow duplicate Tag in TagField
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 13
    Last Post: Dec 31, 2014, 1:51 PM
  3. Store not working with TagField
    By GKG4 in forum 2.x Help
    Replies: 5
    Last Post: Feb 13, 2014, 5:20 AM
  4. Replies: 0
    Last Post: Jul 21, 2012, 9:08 AM
  5. [CLOSED] [1.0] ComboBox automatically clears value?
    By MP in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 27, 2010, 6:20 PM

Posting Permissions