0

I'm currently testing kendoUI and developping a little webapp.

For some reason I need to pass my dataSource.datas from a view to another. In order to do this I use sessionStorage and when I try to put my dataSource.data() in sessionStorage, the return is empty.

See here when I put a log to test if my dataSource.data() is correctly inserted/returned

dataSource.data() log

However, when I put a log to test ma dataSource I can clearly see that _data is not empty as it is showed in the follow picture :

dataSource _data

Did someone know the origin of my problem ?

EDIT

here is the code that shows how I add my dataSource to sessionStorage :

var qui   = (e.view.params.qui)  ? e.view.params.qui  : "";
var quoi  = (e.view.params.quoi) ? e.view.params.quoi : "";

dataSourceFournisseurs = new kendo.data.DataSource({
        transport : {
             read : {
                   url:"annuaire.json",
              dataType:"json"
                     }
        },
        schema : {
            data : "data",
                   model : {
                       DISTANCE: function() {
                           var lat   = this.get("LATITUDE");
                           var lng   = this.get("LONGITUDE");

                           var distance = APP.distanceBetweenCoords(lat, lng);

                           return "à " + distance + "km";          
                        }
                   }
       },
               sort : {
            field : "LIBELLE",
              dir : "asc"
       },
       filter: [
            { field: "LIBELLE", operator: "contains", value: qui },
            { field: "NAFLIBELLE", operator: "contains", value: quoi }
       ]

});
console.log(dataSourceFournisseurs);
session.setValueObject("liste", dataSourceFournisseurs.data());

And here is how I retrieve it :

var datas = session.getValueObject("liste");
console.log(datas);

PS :

  • setValueObject and getValueObject are two methods I wrote in order to Stringify the datas I set and Parse the retrieved datas (there are fully functionnal I use them for over a year)

  • the two console.log are those that represent the picture above (picture 1 with second log and picture 2 with first log)

EDIT END

neobagram
  • 87
  • 1
  • 8
  • 1
    Can you please demonstrate in code how you are adding and retrieving the data in sessionStorage? – Brett Mar 28 '14 at 12:25

1 Answers1

0

Try using dataSourceFournisseurs.view(). This should give you the all of the data. Using data is meant for initial configuration, and is not meant to be used as a method for retrieving data.

Bonne chance!

ohgross
  • 129
  • 10