Select to view content in your preferred language

Clear Grid

1740
14
Jump to solution
04-15-2014 10:20 AM
jaykapalczynski
Frequent Contributor
I am populating my grid with this
Looking for a way to clear the grid on the start of another tool...


        var data = arrayUtils.map(featureSet.features, function (entry, i) {           return {             NAME: entry.attributes.SITENAME,             REGION: entry.attributes.REGION,             WATERBODY: entry.attributes.WATERBODY,             TYPE: entry.attributes.TYPE,             ACCESSAREA: entry.attributes.ACCESSAREA,             LOCATION: entry.attributes.LOCATION           };         });         grid.store.setData(data);         grid.refresh();



I tried to create a new Grid and clear it but not having luck....any thoughts?


var newStore = new dojo.data.ItemFileReadStore({data: {  identifier: "",  items: []}});  var grid = dijit.byId("grid");  grid.setStore(newStore); }
0 Kudos
14 Replies
jaykapalczynski
Frequent Contributor
I was able to combine the two examples above and get the grid working and the Grid / Map interaction where the feature will highlight on grid selection and the grid row will highlight upon feature in map selection

So the only thing I need to figure out is how to modify the grid to act in this manner


Field 1        Field 2      Field 4       Field 5
               Field 3


Where field one is set in place and does not move when scrolled to the right to see remaining fields.....ALMOST There

Can someone help with the GRid Format to align i the above fashion

http://jsfiddle.net/HLdyV/31/
0 Kudos
jaykapalczynski
Frequent Contributor
I am trying the below dgrid formatting.....Its sort of working.

  • I can click the features in the map and the grid is responding by moving to the record, BUT there is no Data being displayed

  • And the format I am trying to achieve is not being reflected in the dgrid


http://jsfiddle.net/HLdyV/67/

Is my CSS correct?

Anyone have a few minutes to view this....where am I going wrong here....I know I am close

referencing this source..  view-source:http://dojofoundation.org/packages/dgrid/js/dgrid/test/complex_column.html
0 Kudos
jaykapalczynski
Frequent Contributor
Any thoughts on my last post jon.uihlein

Am i close?  Object error...not sure about that

Thanks
0 Kudos
JonathanUihlein
Esri Regular Contributor
 var data = array.map(results.features, function(feature) {   return {                       "id": feature.attributes[outFields[0]],         "NAME": feature.attributes[outFields[2]],         "WATERBODY": feature.attributes[outFields[3]],         "ACCESSAREA": feature.attributes[outFields[5]],         "LOCATION": feature.attributes[outFields[9]]   } }); 


This is wrong because outFields[5] and outFields[9] do not exist in your application.

This is your current outFields array:

outFields = ["OBJECTID", "SITENAME", "WATERBODY", "ACCESSAREA", "LOCATION"];


outFields[0] is "OBJECTID", outField[1] is "SITENAME" etc.

There are five elements so anything up to outFields[4] is valid.

outFields[9] returns undefined. You can confirm this by checking your current store implementation.

Out of curiosity, where did you come up with outFields[9]?

This is valid:

 var data = array.map(results.features, function(feature) {   return {                     "id": feature.attributes[outFields[0]],       "SITENAME": feature.attributes[outFields[1]],       "WATERBODY": feature.attributes[outFields[2]],       "ACCESSAREA": feature.attributes[outFields[3]],       "LOCATION": feature.attributes[outFields[4]]   } }); 


Another option is:

 var data = array.map(results.features, function(feature) {   return {                     "id": feature.attributes["OBJECTID"],       "SITENAME": feature.attributes["SITENAME"],       "WATERBODY": feature.attributes["WATERBODY"],       "ACCESSAREA": feature.attributes["ACCESSAREA"],       "LOCATION": feature.attributes["LOCATION"]   } }); 


As for the data not showing up in the grid, you are missing several key pieces in addition to fixing your data store.

1) You are using a columnSet. You need to bring in the columnSet module in your require: "dgrid/ColumnSet" / ColumnSet

2) Use columnSet in your grid definition:   gridNoColumnSets = new (declare([Grid, Selection, ColumnSet]))({...

2.5) Rename your grid to something else 🙂

3) Set the columnSets property of your grid:

gridNoColumnSets.set("columnSets", columnExample2);
0 Kudos
jaykapalczynski
Frequent Contributor
FANTASTIC.....very appreciated.

Cheers

http://jsfiddle.net/Jaykapalczynski/HLdyV/114/
0 Kudos