Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    FilterEditor doesnt fire after datasource update

    Hi,
    We have a problem with the filtereditor of a Listgrid. We haven't changed something at this during the update to smartclient 10, and it was working with smartclietn 9.1 so we assume there were some changes resulting into this bug. Because we are using sessions and the restricted datasources we cannot create an example for fast reproduction. I'll try to describe the problem as detailed as i can.

    We are using the datasource in a lsitgrid and have around 8k values. At the beginning a specific subset is loaded over the datasource.
    Code:
    isc.ListGrid.create({
    	"ID" : "theListGrid",
    	"showFilterEditor" : false,
    	"selectionType" : "single",
    	"canEdit" : true,
    	"editEvent" : "click",
    	"height" : 600,
    	"width" : 600,
    	"validateByCell" : true,
    	dataSource : isc.DataSource.create({
    		"fields" :
    		[{
    			"name" : "theIndex",
    			"title" : "Index",
    			"type" : "text",
    			"width" : 20,
    			"canEdit" : false,
    		},{
    			"name" : "theFirstField",
    			"title" : "first field",
    			"type" : "text",
    			"width" : "*",
    			"canEdit" : true,
    			"editorProperties" : {
    				"ID" : "theFirstField_editor"
    			}
    		}
    		],
    		"dataFormat" : "json",
    		"dataURL" : "our datasource",
    		"transformRequest" : ourRequestHandler,
    		"transformResponse" : ourResponseHandler,
    		"recordXPath" : "\/resultData"
    	}),
    	"autoFetchData" : true,
    	"dataProperties" : {
    		"useClientFiltering" : false
    	}
    });
    If the user enables a checkbox, the result of the datasource changes and we are calling this methods
    Code:
    theListGrid.setShowFilterEditor(true);
    theListGrid.invalidateCache();
    theListGrid.fetchData();
    Then the editorfilter shows up and the user can type and submit the value via enter.
    The result json of the datasource shows no errors and the entry is saved sucessfully.
    Code:
    {
     "resultData":
     {
      "theIndex": 1
      "theFirstField":"the new changed value",
     }
    }
    After this the user want to search for another item with the editorfilter.

    The user can enter the text he's searching for, but by clicking enter the listgrid doesnt fire an event to search in the datasource and therefore the last searchresults are staying in the listgrid. I assume there's a bug, which prevents the event being fired after an datasource-update.

    Currently we are using SmartClient_v100p_2014-10-28_Pro and the problem exists with all browsers.

    #2
    This unfortunately doesn't give us enough to identify a cause.
    Clearly the standard flow of a user interacting with a filterEditor, causing a new fetch be performed against a DataSource works in 10.0, so the trick is going to be identifying what's special about your usage which is causing this to fail.

    Firstly - if you install a 'filterEditorSubmit' handler on your ListGrid, are you seeing that execute when the user interacts with the filter editor (either hitting the Enter key, or hitting the filter button).
    If not, the place to look is the ListGrid configuration - specifically any customizations to the filter editor items, etc.

    Assuming this is working, the standard filterEditorSubmit behavior fires filterData() on the grid - you could override that method on your instance, or observe it using the watch tab and see if it is firing, and if the criteria passed into it are what you expect.

    If this step is behaving as expected, the next thing we'd expect to happen would be a comparison of the user-entered criteria against the current criteria applied to the grid. If they are less restrictive, or if the grid doesn't have a full cache of data, you'd expect to see a fetch against the DataSource. The transformRequest method [you already have a custom handler there] would be fired, and you'd see the request come in. If this is all working as expected, the problem is likely in your DataSource implementation.

    If the criteria are more restrictive, and you already have a local cache of data, you should see local filtering occur, and the ListGrid rows should be updated without the need for a DataSource fetch. If this appears not to be working, you could look at the resultSet criteria before and after the user interaction to see if they have changed as expected, as well as possibly checking details of the data itself (the result of getLength(), looking at actual records returned from 'get', etc).

    Ultimately, once you've identified where the failure is occurring, you can probably show us a test case based on a simple dummy datasource [either a clientOnly DS, or something with a canned static JSON response stored in a file, etc] which demonstrates exactly what's going wrong for you.

    (And obviously - all of this is moot if you're seeing any JavaScript errors, or major warnings showing up in the developer console, as these would probably indicate something specific that is going wrong without the need for this troubleshooting!)

    Thanks
    Isomorphic Software

    Comment


      #3
      Thanks for your answer.
      We updated several times in the last few week and are currently using v10.0p_2014-11-12. In this version and above it seems to be fixed.
      Note to this: we haven't changed anything, but now it works again.
      hooray ;)

      Thanks again

      Comment

      Working...
      X