javascript - itemfilereadstore reading from json file -


i'm starting out dojo , trying thumbnail gallery display json file no luck far. i've searched , viewed other examples none have helped me. please me see i'm doing wrong.

it's working when specifying data in script however(as shown commented out code) can't read data external file.

my code far:

 <script>      require(["dojo/ready",          "dijit/registry",          "dojo/dom",          "dojo/on",          "dojo/parser",          "dojo/data/itemfilereadstore",          "dojox/image/gallery"     ], function (ready, registry, dom, on, parser, ifrs, gallery) {          ready(function () {             // define attribute names used access items in data store             parser.parse();             var itemnamemap = {                 imagethumbattr: "thumb",                 imagelargeattr: "large"             };              // define request, no query, , count of 20, 20 items             // requested each request             var request = {                 query: {},                 count: 20             };             // var store = new ifrs(imgs);           /*   imageitemstore.data = {                 identifier: 'title',                 label: 'images',                 items: [                     {                         thumb: "http://www.flickr.com/photos/44153025@n00/748348847",                         large: "http://www.flickr.com/photos/44153025@n00/748348847",                         title: "photo"                     }                 ]             };*/                 imageitemstore = new dojo.data.itemfilereadstore({ url: "/images.json" });                 registry.byid('gallery1').setdatastore(imageitemstore, request, itemnamemap);          });     });         </script> 

my json file:

{ items: [ {   "thumb":"images/extrawide.jpg",   "large":"images/extrawide.jpg",   "title":"i'm wide, me",   "link":"http://www.flickr.com/photos/44153025@n00/748348847" }, {  "thumb":"images/imagehoriz.jpg",   "large":"images/imagehoriz.jpg",   "title":"i'm horizontal picture",   "link":"http://www.flickr.com/photos/44153025@n00/735656038" }, {   "thumb":"images/imagehoriz2.jpg",   "large":"images/imagehoriz2.jpg",   "title":"i'm horizontal picture",   "link":"http://www.flickr.com/photos/44153025@n00/714540483" }, {  "thumb":"images/imagevert.jpg",   "large":"images/imagevert.jpg",   "title":"i'm vertical picture",   "link":"http://www.flickr.com/photos/44153025@n00/715392758" }, {  "large":"images/square.jpg",  "thumb":"images/square.jpg",  "link" :"images/square.jpg",  "title":"1:1 aspect ratio" } ]} 

my markup:

<div class="claro" style="height:400px">         <div data-dojo-type="dojox.image.gallery" id="gallery1" style="height:400px"></div>     <div data-dojo-id="imageitemstore" data-dojo-type="dojo.data.itemfilereadstore"></div>     </div> 

any appreciated

have looked jsonrest store instead of itemfilereadstore? http://dojotoolkit.org/reference-guide/1.9/dojo/store/jsonrest.html


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -