misoproject / dataset

JavaScript library that makes managing the data behind client-side visualisations easy
http://misoproject.com
GNU General Public License v2.0
1.18k stars 99 forks source link

issue with _when() #224

Open guig0 opened 10 years ago

guig0 commented 10 years ago

Hello,

I am having some issue with the _when function. Here is my code :

var myGoogleSpreadsheet = ;// some google spreadsheet url
var ds = [];
var nbTab = 2;
for (j=0;j<nbTab;j++){
    ds[j]=loadDS(myGoogleSpreadsheet ,j+1);
}
var str="";
for (j=1;j<nbTab;j++){
    str += "ds["+(j-1)+"].fetch()";
    if (j<nbTab-1){str+=",";}
}

_.when(eval(str)).then(function() {
log("eval ds0:"+ds[0].columnNames()+"ds1:"+ds[1].columnNames());
});
_.when(ds[0].fetch()).then(function() {
log("not eval"+ds[0].columnNames());
});

The first _when() doesn't return a result at each time.

While if I change the code too :

_.when(ds[0].fetch()).then(function() {
log("not eval"+ds[0].columnNames());
});
_.when(eval(str)).then(function() {
log("eval ds0:"+ds[0].columnNames()+"ds1:"+ds[1].columnNames());
});

I always seem to have a result. Am I missing something here ?

Kind regards guillaume