Skip to content
Browse files

First working version of the DataSet. It wasn't working before as pen…

…dingRequest needs to be set to null to give the region the heads up the data is done.

Path selection works really fine, what is left to do is object flattening and probably setPath / getPath / setQuery / getQuery methods
  • Loading branch information...
1 parent b5a1647 commit 09e24cb8343c3ebbdba42bc48c62263bfa471075 @3rd-Eden committed
Showing with 25 additions and 2 deletions.
  1. +25 −2 SpryDataYQLDataSet.js
View
27 SpryDataYQLDataSet.js
@@ -11,7 +11,7 @@
this.timeout = 10000;
this.query = query;
this.prefix = "yql_";
- this.path = path || "";
+ this.path = path || false;
this.doc = null;
this.preparseFunc = null;
@@ -155,12 +155,18 @@
if( this.preparseFunc )
result = this.preparseFunc( result );
+ // execute the path, in search for data :)!
+ if( this.path )
+ result = Spry.Utils.getObjectByName( this.path, result );
+
// todo process the data based on path
+ this.data = dataset.concat( result );
+ this.dataHash = hash;
// process completed and notify the user
this.dataWasLoaded = true;
- this.pendingRequest = false;
+ this.pendingRequest = null;
this.syncColumnTypesToData();
this.applyColumnTypes();
@@ -209,4 +215,21 @@
Spry.Data.YQLDataSet.receiver[ that.prefix + "" + id ] = function(){ delete Spry.Data.YQLDataSet.receiver[ that.prefix + "" + id ]; };
}
+
+ // modified from the origional to be used with a context argument to search for "paths"
+ Spry.Utils.getObjectByName = function( name, context ){
+ var result = null,
+ lu = context || window, objPath, i, length;
+
+ if (name) {
+
+ objPath = name.split(".");
+
+ for ( i = 0, length = objPath.length; lu && i < length; i++ ){
+ result = lu[ objPath[i] ];
+ lu = result;
+ }
+ }
+ return result;
+ };
})()

0 comments on commit 09e24cb

Please sign in to comment.
Something went wrong with that request. Please try again.