a:23:{s:9:"#provides";s:23:"dojox.data.ClientFilter";s:9:"#resource";s:20:"data/ClientFilter.js";s:9:"#requires";a:1:{i:0;a:3:{i:0;s:6:"common";i:1;s:21:"dojo.data.util.filter";i:2;s:4:"dojo";}}s:23:"dojox.data.ClientFilter";a:6:{s:4:"type";s:8:"Function";s:6:"source";s:190:" this.onSet = addUpdate(this,true,true); this.onNew = addUpdate(this,true,false); this.onDelete = addUpdate(this,false,true); this._updates= []; this._fetchCache = []; ";s:7:"summary";s:252:"This is an abstract class that data stores can extend to add updateable result set functionality as well as client side querying capabilities. This enables widgets to be aware of how active results change in response to the modifications/notifications.";s:11:"description";s:1389:"To a update a result set after a notification (onNew, onSet, and onDelete), widgets can call the updateResultSet method. Widgets can use the updated result sets to determine how to react to notifications, and how to update their displayed results based on changes. This module will use the best available information to update result sets, using query attribute objects to determine if items are in a result set, and using the sort arrays to maintain sort information. However, queries can be opaque strings, and this module can not update results by itself in this case. In this situations, data stores can provide a isUpdateable(request) function and matchesQuery(item,request) function. If a data store can handle a query, it can return true from isUpdateable and if an item matches a query, it can return true from matchesQuery. Here is definition of isUpdateable and matchesQuery isUpdateable(request) - request is the keywords arguments as is passed to the fetch function. matchesQuery(item,request) - item is the item to test, and request is the value arguments object for the fetch function. You can define a property on this object instance "cacheByDefault" to a value of true that will cause all queries to be cached by default unless the cache queryOption is explicitly set to false. This can be defined in the constructor options for ServiceStore/JsonRestStore and subtypes.";s:8:"examples";a:1:{i:0;s:213:"to make a updated-result-set data store from an existing data store: dojo.declare("dojox.data.MyLiveDataStore", dojox.data.MyDataStore,dojox.data.ClientFilter], // subclass LiveResultSets if available {} );";}s:9:"classlike";b:1;}s:39:"dojox.data.ClientFilter.updateResultSet";a:6:{s:9:"prototype";s:23:"dojox.data.ClientFilter";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:9:"resultSet";a:2:{s:4:"type";s:5:"Array";s:7:"summary";s:43:"The result set array that should be updated";}s:7:"request";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:93:"This object follows the same meaning as the keywordArgs passed to a dojo.data.api.Read.fetch.";}}s:6:"source";s:1317:" if(this.isUpdateable(request)){ // we try to avoid rerunning notification updates more than once on the same object for performance for(var i = request._version || 0; i < this._updates.length;i++){ // for each notification,we will update the result set var create = this._updates[i].create; var remove = this._updates[i].remove; if(remove){ for(var j = 0; j < resultSet.length;j++){ if(resultSet[j]==remove){ resultSet.splice(j--,1); var updated = true; } } } if(create && this.matchesQuery(create,request) && // if there is a new/replacement item and it matches the query dojo.indexOf(resultSet,create) == -1){ // and it doesn't already exist in query resultSet.push(create); // should this go at the beginning by default instead? updated = true; } } if(request.sort && updated){ // do the sort if needed resultSet.sort(this.makeComparator(request.sort.concat())); } if(request.count && updated){ // do we really need to do this? // make sure we still find within the defined paging set resultSet.splice(request.count,resultSet.length); } request._version = this._updates.length; return updated ? 2 : 1; } return 0;";s:7:"summary";s:71:"Attempts to update the given result set based on previous notifications";s:11:"description";s:539:"This will attempt to update the provide result based on previous notification, adding new items from onNew calls, removing deleted items, and updating modified items, and properly removing and adding items as required by the query and sort parameters. This function will return: 0: Indicates it could not successfully update the result set 1: Indicates it could successfully handle all the notifications, but no changes were made to the result set 2: Indicates it successfully handled all the notifications and result set has been updated.";}s:37:"dojox.data.ClientFilter.querySuperSet";a:5:{s:9:"prototype";s:23:"dojox.data.ClientFilter";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:9:"argsSuper";a:2:{s:4:"type";s:4:"Dojo";s:7:"summary";s:20:"Data Fetch arguments";}s:7:"argsSub";a:2:{s:4:"type";s:4:"Dojo";s:7:"summary";s:20:"Data Fetch arguments";}}s:6:"source";s:819:" if(argsSuper.query == argsSub.query){ return {}; } if(!(argsSub.query instanceof Object && // sub query must be an object // super query must be non-existent or an object (!argsSuper.query || typeof argsSuper.query == 'object'))){ return false; } var clientQuery = dojo.mixin({},argsSub.query); for(var i in argsSuper.query){ if(clientQuery[i] == argsSuper.query[i]){ delete clientQuery[i]; }else if(!(typeof argsSuper.query[i] == 'string' && // if it is a pattern, we can test to see if it is a sub-pattern // FIXME: This is not technically correct, but it will work for the majority of cases dojo.data.util.filter.patternToRegExp(argsSuper.query[i]).test(clientQuery[i]))){ return false; } } return clientQuery;";s:7:"summary";s:74:"Determines whether the provided arguments are super/sub sets of each other";}s:37:"dojox.data.ClientFilter.serverVersion";a:2:{s:9:"prototype";s:23:"dojox.data.ClientFilter";s:7:"summary";s:0:"";}s:36:"dojox.data.ClientFilter.cachingFetch";a:5:{s:9:"prototype";s:23:"dojox.data.ClientFilter";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"args";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:1673:" var self = this; for(var i = 0; i < this._fetchCache.length;i++){ var cachedArgs = this._fetchCache[i]; var clientQuery = this.querySuperSet(cachedArgs,args); if(clientQuery !== false){ var defResult = cachedArgs._loading; if(!defResult){ defResult = new dojo.Deferred(); defResult.callback(cachedArgs.cacheResults); } defResult.addCallback(function(results){ results = self.clientSideFetch({query:clientQuery,sort:args.sort,start:args.start,count:args.count}, results); defResult.fullLength = results._fullLength; return results; }); } } if(!defResult){ var serverArgs = dojo.mixin({}, args); var putInCache = (args.queryOptions || 0).cache; if(putInCache === undefined ? this.cacheByDefault : putInCache){ // we are caching this request, so we want to get all the data, and page on the client side if(args.start || args.count){ delete serverArgs.start; delete serverArgs.count; args.clientQuery = dojo.mixin(args.clientQuery || {}, { start: args.start, count: args.count }); } args = serverArgs; this._fetchCache.push(args); } defResult= args._loading = this._doQuery(args); } var version = this.serverVersion; defResult.addCallback(function(results){ delete args._loading; // update the result set in case anything changed while we were waiting for the fetch if(results){ args._version = version; self.updateResultSet(results,args); args.cacheResults = results; } return results; }); return defResult;";s:7:"summary";s:0:"";}s:36:"dojox.data.ClientFilter.isUpdateable";a:5:{s:9:"prototype";s:23:"dojox.data.ClientFilter";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"request";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:36:"See dojo.data.api.Read.fetch request";}}s:6:"source";s:44:" return typeof request.query == "object";";s:7:"summary";s:82:"Returns whether the provide fetch arguments can be used to update an existing list";}s:39:"dojox.data.ClientFilter.clientSideFetch";a:5:{s:9:"prototype";s:23:"dojox.data.ClientFilter";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:7:"request";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:36:"See dojo.data.api.Read.fetch request";}s:11:"baseResults";a:2:{s:4:"type";s:5:"Array";s:7:"summary";s:67:"This provides the result set to start with for client side querying";}}s:6:"source";s:584:" if(request.query){ // filter by the query var results = []; for(var i = 0; i < baseResults.length; i++){ var value = baseResults[i]; if(value && this.matchesQuery(value,request)){ results.push(baseResults[i]); } } }else{ results = request.sort ? baseResults.concat() : baseResults; // we don't want to mutate the baseResults if we are doing a sort } if(request.sort){ // do the sort if needed results.sort(this.makeComparator(request.sort.concat())); } return this.clientSidePaging(request, results);";s:7:"summary";s:71:"Performs a query on the client side and returns the results as an array";}s:40:"dojox.data.ClientFilter.clientSidePaging";a:5:{s:9:"prototype";s:23:"dojox.data.ClientFilter";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:7:"request";a:1:{s:4:"type";s:6:"Object";}s:11:"baseResults";a:1:{s:4:"type";s:5:"Array";}}s:6:"source";s:248:" var start = request.start || 0; var finalResults = (start || request.count) ? baseResults.slice(start,start + (request.count || baseResults.length)) : baseResults; finalResults._fullLength = baseResults.length; return finalResults; ";s:7:"summary";s:0:"";}s:36:"dojox.data.ClientFilter.matchesQuery";a:5:{s:9:"prototype";s:23:"dojox.data.ClientFilter";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:4:"item";a:1:{s:4:"type";s:0:"";}s:7:"request";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:501:" var query = request.query; var ignoreCase = request.queryOptions && request.queryOptions.ignoreCase; for(var i in query){ // if anything doesn't match, than this should be in the query var match = query[i]; var value = this.getValue(item,i); if((typeof match == 'string' && (match.match(/[\*\.]/) || ignoreCase)) ? !dojo.data.util.filter.patternToRegExp(match, ignoreCase).test(value) : value != match){ return false; } } return true;";s:7:"summary";s:0:"";}s:38:"dojox.data.ClientFilter.makeComparator";a:6:{s:9:"prototype";s:23:"dojox.data.ClientFilter";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"sort";a:2:{s:4:"type";s:3:"See";s:7:"summary";s:25:"dojox.data.api.Read.fetch";}}s:6:"source";s:517:" var current = sort.shift(); if(!current){ // sort order for ties and no sort orders return function(){}; // keep the order unchanged } var attribute = current.attribute; var descending = !!current.descending; var next = this.makeComparator(sort); var store = this; return function(a,b){ var av = store.getValue(a,attribute); var bv = store.getValue(b,attribute); if(av != bv){ return av < bv == descending ? 1 : -1; } return next(a,b); }; ";s:7:"summary";s:60:"returns a comparator function for the given sort order array";s:7:"returns";s:24:"keep the order unchanged";}s:29:"dojox.data.ClientFilter.onSet";a:2:{s:8:"instance";s:23:"dojox.data.ClientFilter";s:7:"summary";s:0:"";}s:29:"dojox.data.ClientFilter.onNew";a:2:{s:8:"instance";s:23:"dojox.data.ClientFilter";s:7:"summary";s:0:"";}s:32:"dojox.data.ClientFilter.onDelete";a:2:{s:8:"instance";s:23:"dojox.data.ClientFilter";s:7:"summary";s:0:"";}s:32:"dojox.data.ClientFilter._updates";a:3:{s:8:"instance";s:23:"dojox.data.ClientFilter";s:7:"private";b:1;s:7:"summary";s:0:"";}s:35:"dojox.data.ClientFilter._fetchCache";a:3:{s:8:"instance";s:23:"dojox.data.ClientFilter";s:7:"private";b:1;s:7:"summary";s:0:"";}s:11:"cf.onUpdate";a:1:{s:7:"summary";s:0:"";}s:24:".clientQuery || {}.start";a:1:{s:7:"summary";s:0:"";}s:24:".clientQuery || {}.count";a:1:{s:7:"summary";s:0:"";}s:10:"dojox.data";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}