Thanks thejus, this makes sense! Forgive my ignorance - with the existing code above, what would be the easiest way to commit the edits to the server?
Hello Linda
The updateDataGrid.txt does not have any logic to update the server. i.e. no code is calling the featurelayer.applyedits method. the store.setValue updates only the memory variables so as long, you dont search again the values you have updated will remain. But if you get the records again from the service. The original values will be returned.
Hope this answers your doubt.
Thejus
I am having the same issue with this as Adam mentions above - my updated values don't persist when I redo the search. My service is also enabled to allow editing and the value changes in the grid until the search is redone. Checking the database, the value does not change. Has anyone been able to resolve this issue?
Hi Heming,Your solution helped a little bit. The field is displayed properly but the dojoxGrid-master-header is still 46px high. I cannot change that anyway. Here dojoxGrid-header is contained within dojoxGrid-master-header. Please find attached the image of the table on the GIS application. I have tried giving values to this as well but has no effect. Additionally, I have encountered another major issue with this grid. I modified my application a little bit and created two tabs. I moved this grid to one of the tabs and it has stopped showing completely. The height of the grid shows up as 0px in JavaScript Console. I have not yet found a solution to make this grid visible. I'll really appreciate any help.ThanksSamir
Hello, This is in continuation of my previous two messages.....................I believe all features in the header section of Data Grid should conform to changes made to 'dojoxGridMasterHeader' and 'dojoxGridHeader' but it did not work out that way for me. Can someone propose an alternative, or suggest changes to the css below to set this right? I'll really appreciate any help as I have been struggling with it for sometime now.CSS .dojoxGrid th { height: 30px;}.dojoxGridCell { background-color: #505050; color:white; }.tundra .dojoxGridMasterHeader .dojoxGridHeader { height: 30px; }.tundra .dojoxGridSortNode { background-color:#505050; color: orange; height: 30px; }ThanksSamir Gambhir
Also, if I replace store.setValues(item, "indValue", value) with store.setValues(item, "indValue", "xyz"), it populates the table with "xyz", similar to the example you sent earlier.ThanksSamir
if (boxId=="checkTest1"){ store.fetch({query:{},onItem:function(item){ var value = store.getValues(item, "Shape_Leng"); store.setValues(item, "indValue", value); } }); }
Hi Heming,Your suggestion works really well, but I am encountering some problem. Here is my code:data = {items:items};store = new dojo.data.ItemFileWriteStore({data:data});store.fetch({onBegin:function(total){alert("there are "+total+" items in store");}});if (boxId=="checkTest1"){ for (i=0; i<items.length; i++){ var item=items; var value = store.fetch({query:{},onItem:function(item){alert(store.getValues(item, "Shape_Leng"));}}); store.setValues(item, "indValue", value); }}grid.setStore(store);My 'alert' on values returns the right values (and the right count of values), but it does not populate the grid. It fills in the values as [object Object]. Would you know why is this happening?ThanksSamir
if (boxId=="checkTest1"){ var items =store._arrayOfAllItems; for (i=0; i<items.length; i++){ var item=items; var value = store.getValues(item, "Shape_Leng"); store.setValues(item, "indValue", value); } }
Still no luck, Heming,I tried your solution, but it is not reading store.setValue(...) at all. I also put a check to see what values 'item' is returning but have been unsuccessful. Do you have any other suggestion.This part of the code has taken me much longer than all the other portions in my application. Any help will be really appreciated. Also, if you can direct me to a good source to understand the functioning of ItemFileWriteStore with examples, please pass it on.ThanksSamir
Thanks Heming,I believe onRowClickHandler works with one row at a time. Can I use .setValues instead to update all records in the table? As I mentioned earlier, the table should update all values when the user selects another indicator.ThanksSamir
for (i = 0; i < items.length; i++) { var item = items; store.setValue(item, "NB_D_SIGNS, "Test1") ; }
Hi Heming,I am sorry I am still not getting it right. I must be really thick to understand this. I have looked at various forum too but still no luck.It'll be really helpful if you could suggest the soltuion based on the information below:I have described two fields ("name" which has unique values and "NB_D_SIGNS" which has attribute values for each "name") in the grid structure in my html file. "NB_D_SIGNS" is missing from the code that I pasted in my last email.Items array, I understand, holds pairs of information such as "name" and value of an indicator. My other indicators are "Test1" and "Test2".My two questions are:Having defined my field name in my HTML, what code will update the values of field "NB_D_SIGNS" to values of the field, say "Test1"?In the normal sequence of code( data = {items:items}; store=new dojo.data.ItemFileWriteStore({data:data}); grid.setStore(store);) where does the .setValue code fit in?I'll really appreciate it if you could help.ThanksSamir
Hi Heming, I am trying to set the value for the store in a datagrid based on the function that you suggested (store.setValue....). Unfortunately, I am not being able to understand the parameters that I need to pass to get this to work. I am pasting a portion of my code (pertaining to data grid). I hope you'll be able to help me starighten this out: HTML CODE: <div data-dojo-type="dijit.form.Form" id="distDataTable" name="distDataTable"> <div id="stateInfo" name="stateInfo"></div><!--Message informing which State/UT is being viewed--> <div id="indicatorInfo" name="indicatorInfo"></div> <table data-dojo-type="dojox.grid.DataGrid" class="grid" data-dojo-id="grid" id="grid" rowsPerPage="15" rowSelector="20px"> <thead> <tr> <th field="name" width="auto" height="30px">District</th> <th width="auto" height="30px"><p style="font:Calibri; font-size:12px;">Indicator value (%)</p></th> </tr> </thead> </table> <div data-dojo-type="dijit.form.Form" id="downloadData" name="downloadData"> <button dojoType="dijit.form.Button" id="dataDownload" name="dataDownload">DOWNLOAD THIS DATA</button> </div> <div id="clear" style="clear:both;"></div> </div> JS CODE: queryTask.execute(query, function(featureSet){ var results=[], attr=[], items=[]; for (i=0, il=featureSet.features.length; i<il; i++) { var graphic = featureSet.features; graphic.setInfoTemplate(infoTemplate); distGraphicsLayer.add(graphic); items.push(graphic.attributes); } dijit.byId('progress').hide(); distGraphicsLayer.show(); data = {items:items}; store = new dojo.data.ItemFileWriteStore({data:data}); if (boxId=="checkNBD"){ store.setValue(item, "NB_D_SIGNS"); } grid.setStore(store); }); I'll be happy to send you the entire code if you like. Thanks for all yur help, Samir
Hi Heming,Your example helped me figure out most of the styling for my grid except for the header. I have tried multiple ways to remove the shiny silver skin on top of my header but have been unsuccessful. I tried th#gridHdr0{} and th#gridHdr1{} to set thier background-color property. It works but shows these colors behind the silver skin. Any suggestions to remove the skin? Is it possible this skin might e part of another div element?ThanksSamir
Hi Heming, I tried unsuccessfully to override tundra.css for my dojo grid. Can you point me to some examples where I can learn to do this?ThanksSamir
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.