Select to view content in your preferred language

dgrid version

920
2
Jump to solution
09-30-2013 04:27 PM
GeorgeSimpson
Regular Contributor
Has anyone tried to use a newer version of dgrid with the JS API?  I need an event that isn't available until v 0.3.5 that tells me when the dgrid has refreshed.  For now, I'm working around the issue with aspect.after on the "_updateNavigation" property which is a little ugly.

Also, is there a particular reason that the JS API includes such an old version of the dgrid?  Something I should look out for?
0 Kudos
1 Solution

Accepted Solutions
YohanBienvenue
Frequent Contributor
I'm currently using dgrid 0.3.10 along with the ArcGIS API JS API 3.6. I haven't had any problems so far, in fact I didn't even know until recently that dgrid was now bundled with the API.

I use the dgrid-refresh-complete event to do some post-styling to the grid (e.g. custom row colors) when the store is updated. It's also called whenever the user re-sorts the grid manually.

Here's some partial code, for those interested.

      <script type="text/javascript">                    var locationPathname = location.pathname.replace(/[^\/]+$/, '');                    var dojoConfig = {             async: true,             locale: "fr",                                                        // [YB 2013/08/08 : This will make dijits use french]             packages: [                { name: "viewer",       location: locationPathname + "js/viewer" },                { name: "gis",          location: locationPathname + "js/gis"    },                { name: "put-selector", location: locationPathname + "js/put-selector" }, // xstyle & dgrid dependency                { name: "xstyle",       location: locationPathname + "js/xstyle" },       // dgrid dependecy                { name: "dgrid",        location: locationPathname + "js/dgrid" }             ]          };                      </script>  


         // Create a new dgrid constructor by mixing in the optional components we want to add          var CustomGrid = declare([ OnDemandGrid, Keyboard, Selection ]);           this.store = new Memory({ idProperty: "code", data: [] });           this.grid = new CustomGrid({             columns: {                color: "",                rank: "Rang",                label: "Territoire",                value: "Nombre"             },             store: this.store,             selectionMode: "single",                                            // for Selection; only select a single row at a time             cellNavigation: false                                               // for Keyboard; allow only row-level keyboard navigation          }, "exploreSecteurActivite-grid");          this.grid.on("dgrid-select", lang.hitch(this, this.onGridSelect));          this.grid.on("dgrid-refresh-complete", lang.hitch(this, this.onGridRefreshComplete));


   // Update the grid    this.store.setData(data);    this.grid.refresh();

View solution in original post

0 Kudos
2 Replies
YohanBienvenue
Frequent Contributor
I'm currently using dgrid 0.3.10 along with the ArcGIS API JS API 3.6. I haven't had any problems so far, in fact I didn't even know until recently that dgrid was now bundled with the API.

I use the dgrid-refresh-complete event to do some post-styling to the grid (e.g. custom row colors) when the store is updated. It's also called whenever the user re-sorts the grid manually.

Here's some partial code, for those interested.

      <script type="text/javascript">                    var locationPathname = location.pathname.replace(/[^\/]+$/, '');                    var dojoConfig = {             async: true,             locale: "fr",                                                        // [YB 2013/08/08 : This will make dijits use french]             packages: [                { name: "viewer",       location: locationPathname + "js/viewer" },                { name: "gis",          location: locationPathname + "js/gis"    },                { name: "put-selector", location: locationPathname + "js/put-selector" }, // xstyle & dgrid dependency                { name: "xstyle",       location: locationPathname + "js/xstyle" },       // dgrid dependecy                { name: "dgrid",        location: locationPathname + "js/dgrid" }             ]          };                      </script>  


         // Create a new dgrid constructor by mixing in the optional components we want to add          var CustomGrid = declare([ OnDemandGrid, Keyboard, Selection ]);           this.store = new Memory({ idProperty: "code", data: [] });           this.grid = new CustomGrid({             columns: {                color: "",                rank: "Rang",                label: "Territoire",                value: "Nombre"             },             store: this.store,             selectionMode: "single",                                            // for Selection; only select a single row at a time             cellNavigation: false                                               // for Keyboard; allow only row-level keyboard navigation          }, "exploreSecteurActivite-grid");          this.grid.on("dgrid-select", lang.hitch(this, this.onGridSelect));          this.grid.on("dgrid-refresh-complete", lang.hitch(this, this.onGridRefreshComplete));


   // Update the grid    this.store.setData(data);    this.grid.refresh();
0 Kudos
GeorgeSimpson
Regular Contributor
Excellent!  Thanks
0 Kudos