|
POST
|
It's definitely a proxy issue. You need to change the path for proxyUrl so that your application can find your proxy. For example, when I downloaded the CSV sample from the sandbox, I too encountered an error when first trying to run the application. I was able to fix this issue by entering the correct path to my proxy. urlUtils.addProxyRule({
proxyUrl: "../../proxy/DotNet/proxy.ashx",
urlPrefix: "earthquake.usgs.gov"
});
... View more
04-11-2014
12:54 PM
|
0
|
0
|
1143
|
|
POST
|
Hey John, If you have time, could you create a sample of your issue using jsfiddle.net? I'd love to take a look. In the meantime, I found this sample that sets the outFields directly and it seems to work as expected. https://developers.arcgis.com/javascript/jssamples/fl_dgrid.html If you change outFields to ["*"], you will see there are a lot more fields than when using: outFields = ["OBJECTID", "NAME", "MEDNW_CY"];
... View more
04-11-2014
12:45 PM
|
0
|
0
|
7950
|
|
POST
|
Jon, I tried the formatter with get, and the images are showing, but not correctly. They all show red even though there should be some red and some green. I think this has to do with the fact that the original TimeStamp is in epoch time and I am trying to compare it to the new Date(). Is there a way to format it, then compare the formatted TimeStamp? Or, do I need to create a new column and compare the formatted column to new Date(), then use Column Hider to hide the formatted TimeStamp column so that all that shows is the image? You are helping me with another issue, and the information for this issue is in the jsfiddle for that one. It's the same website. Again, any help is much appreciated. You can do everything from within get() and formatter(). No need for another column just for math. I have a perfect code sample that you should be able to manipulate for your use case. In one of my data grid applications, I compare an epoch timestamp to the current time and print how long ago the timestamp was. NOTE: - I don't use get() because I only need the value of that particular cell on that particular row - lastMod is the name of my column and it represents when the data in that row was 'last modified.' - value represents the specific value of lastMod in this function columns: [ { label:"Last Seen", field: "lastMod", formatter: function(value){ var timeStamp = new Date(value); var minutesAgo = Math.floor((new Date().getTime() - value) / 60000); if(minutesAgo > 0 && minutesAgo < 1){minutesAgo = 1}; if(minutesAgo > 60){ var hours = minutesAgo / 60; if( hours > 24){ var days = hours / 24; return Math.floor(days) + " Day(s)"; } return Math.floor(hours) + " Hour(s)"; } return minutesAgo + " Minute(s)"; } } ]; Psuedo Code: //1397236556000 var lastUpdated = 1397236556000; //1397248094113 var rightNow = new Date().getTime(); // var minutesSinceLastUpdate = Math.floor((1397248094113 - 1397236556000) / 60000); // var minutesSinceLastUpdate = Math.floor((rightNow - lastUpdated) / 60000); var minutesSinceLastUpdate = Math.floor((new Date().getTime() - lastUpdated ) / 60000); //minutesSinceLastUpdate is equal to 192 Minutes
... View more
04-11-2014
12:22 PM
|
0
|
0
|
2475
|
|
POST
|
You probably know this but it's because when you include the jquery-mobile script, it adds a bunch of CSS rules to your page. I have a temporary solution but you'll want to find a better one eventually: In tundra.css, change the following from relative to absolute:
.dijitBorderContainer, .dijitBorderContainerNoGutter {
overflow: hidden;
position: relative;
z-index: 0;
}
.dijitBorderContainer, .dijitBorderContainerNoGutter {
overflow: hidden;
position: absolute;
z-index: 0;
}
... View more
04-10-2014
01:41 PM
|
0
|
0
|
3189
|
|
POST
|
Ah I thought I said that. My mistake! I've not used renderCell much. I prefer using get() and formatter() together for rendering HTML within cells (images in particular). It lets you check/pass values of other cells on that row as well. According to the documentation: (https://github.com/SitePen/dgrid/wiki/Grid) (Note: if formatter is specified, renderCell is ignored.) ^ This makes sense, because they really do the same thing. Formatter is more friendly with raw HTML I believe, so you might want to use that. The workflow is basically... 1) get() has access to the row in object form. 2) Whatever you return from the get() function is passed to formatter() 3) formatter() returns the actual text/image etc to be rendered in that cell. Here is a working JSFiddle that checks the value of col3 using an if statement and either returns a green div, or a red image, or the default value of that cell. http://jsfiddle.net/sxQ3m/1/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dynamic dgrid columns</title>
<link rel="stylesheet" href="https://community.esri.com//ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo/resources/dojo.css">
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dijit/themes/tundra/tundra.css" />
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dgrid/css/dgrid.css">
<style type="text/css">
body, html{
margin:0;
padding:0;
height:100%;
width:100%;
}
#grid{
border:0px;
width:100%;
height:100%;
}
</style>
<link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css">
<script src="http://js.arcgis.com/3.8/"></script>
<script>
var data = [{"id":0,"col1":"normal","col2":false,"col3":"new","col4":"But are not followed by two hexadecimal","col5":29.91,"col6":10,"col7":false},{"id":1,"col1":"important","col2":false,"col3":"new","col4":"Because a % sign always indicates","col5":9.33,"col6":-5,"col7":false},{"id":2,"col1":"important","col2":false,"col3":"read","col4":"Signs can be selectively","col5":19.34,"col6":0,"col7":true},{"id":3,"col1":"note","col2":false,"col3":"read","col4":"However the reserved characters","col5":15.63,"col6":0,"col7":true},{"id":4,"col1":"normal","col2":false,"col3":"replied","col4":"It is therefore necessary","col5":24.22,"col6":5.5,"col7":true},{"id":5,"col1":"important","col2":false,"col3":"replied","col4":"To problems of corruption by","col5":9.12,"col6":-3,"col7":true},{"id":6,"col1":"note","col2":false,"col3":"replied","col4":"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris","col5":12.15,"col6":-4,"col7":false},{"id":7,"col1":"normal","col2":false,"col3":"new","col4":"But are not followed by two hexadecimal","col5":29.91,"col6":10,"col7":false},{"id":8,"col1":"important","col2":false,"col3":"new","col4":"Because a % sign always indicates","col5":9.33,"col6":-5,"col7":false},{"id":9,"col1":"important","col2":false,"col3":"read","col4":"Signs can be selectively","col5":19.34,"col6":0,"col7":true},{"id":10,"col1":"note","col2":false,"col3":"read","col4":"However the reserved characters","col5":15.63,"col6":0,"col7":true},{"id":11,"col1":"normal","col2":false,"col3":"replied","col4":"It is therefore necessary","col5":24.22,"col6":5.5,"col7":true},{"id":12,"col1":"important","col2":false,"col3":"replied","col4":"To problems of corruption by","col5":9.12,"col6":-3,"col7":true},{"id":13,"col1":"note","col2":false,"col3":"replied","col4":"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris","col5":12.15,"col6":-4,"col7":false},{"id":14,"col1":"normal","col2":false,"col3":"new","col4":"But are not followed by two hexadecimal","col5":29.91,"col6":10,"col7":false},{"id":15,"col1":"important","col2":false,"col3":"new","col4":"Because a % sign always indicates","col5":9.33,"col6":-5,"col7":false},{"id":16,"col1":"important","col2":false,"col3":"read","col4":"Signs can be selectively","col5":19.34,"col6":0,"col7":true},{"id":17,"col1":"note","col2":false,"col3":"read","col4":"However the reserved characters","col5":15.63,"col6":0,"col7":true},{"id":18,"col1":"normal","col2":false,"col3":"replied","col4":"It is therefore necessary","col5":24.22,"col6":5.5,"col7":true},{"id":19,"col1":"important","col2":false,"col3":"replied","col4":"To problems of corruption by","col5":9.12,"col6":-3,"col7":true},{"id":20,"col1":"note","col2":false,"col3":"replied","col4":"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris","col5":12.15,"col6":-4,"col7":false},{"id":21,"col1":"normal","col2":false,"col3":"new","col4":"But are not followed by two hexadecimal","col5":29.91,"col6":10,"col7":false}];
require([
"dojo/_base/declare",
"dgrid/OnDemandGrid",
"dojo/ready",
"dojo/store/Memory",
],
function(declare, OnDemandGrid, ready, Memory){
ready(function () {
var dataStore;
var CustomGrid = declare([ OnDemandGrid]);
var grid = new CustomGrid({
bufferRows: Infinity,
cellNavigation: false,
escapeHTMLInData: false,
noDataMessage: "NO DATA",
loadingMessage: "LOADING",
selectionMode: "single",
}, "grid");
var columnExample1 = [
{
"field": "col1",
"label" : "col1"
},
{
"field": "col2",
"label" : "col2"
},
{
// You can reuse field values to create compound columns
"field": "col2",
"label" : "SUPER COLUMN",
"formatter" : function (value) {
return "col1: " +value[0] + " ... col2: " + value[1];
},
"get" : function (obj) {
// obj represnts the the whole row... you can access different cells by their field
// E.G. obj.col1 or obj.col3
return [obj.col1, obj.col2];
}
},
{
"field": "col3",
"label" : "col3",
"formatter" : function (value) {
return value;
},
"get" : function (obj) {
if(obj.col3 === "new"){
return "<div style='width:15px; height:15px; background-color:green;'></div>";
}else if(obj.col3 === "read"){
return "<img src='http://upload.wikimedia.org/wikipedia/commons/5/52/Small_red_circle.png' />";
}
return obj.col3;
}
},
{
"field": "col4",
"label" : "col4",
"formatter" : function (value) {
return value;
},
"get" : function (obj) {
return obj.col4;
}
}
];
// Set Columns
grid.setColumns(columnExample1);
// If you use a store...
dataStore = new Memory ({"data": data});
grid.set("store", dataStore);
grid.startup();
});
});
</script>
</head>
<body class="tundra"></body>
</html>
... View more
04-10-2014
12:56 PM
|
2
|
0
|
2475
|
|
POST
|
I guess I am confused on where this code would go. I have only been dealing with esri's javascript api for about 4 months, and javascript in general for about a year. I can post the full code to a jsfiddle if needed so that you have a better understanding of what I'm trying to do, you would have to replace the service with a public facing one as ours is sensitive information so it's not public. A JSFiddle would be great!
... View more
04-10-2014
12:30 PM
|
0
|
0
|
2443
|
|
POST
|
Am I correct in assuming that the images are in their own column (a unique cell on each row in the table)?
... View more
04-10-2014
12:30 PM
|
0
|
0
|
2475
|
|
POST
|
Also, we were wanting the user to know when there are no records for the query that they searched for, and by putting this in there, that is not possible. It's totally possible; you would just need to write your own logic to update the contents of that div depending on a) the query and b) the results. Pseudo Code:
// Default Grid State
grid.noDataMessage = "";
grid.refresh();
//When the query is executed...
grid.noDataMessage = "Loading...";
grid.refresh();
//When the query is done...
//div only shows if query returns nothing... this is just in case of that
grid.noDataMessage = "No Results.";
grid.refresh();
This is using text of course. Logic for using an image would differ slightly in that I would create a child div inside of: <div class="dgrid-no-data"></div> ... and use that div to show the spinner gif.
... View more
04-10-2014
12:19 PM
|
0
|
0
|
2443
|
|
POST
|
Great! If you don't mind me asking, where did you find that piece of information? I want to make a note of it in case anyone has a similar issue.
... View more
04-10-2014
09:56 AM
|
0
|
0
|
2569
|
|
POST
|
dialog.destroy(); If you aren't sure what methods a class has, always refer to the documentation. I cannot say this enough times. 9 times out of 10, one can find the answer to their question by reading the manual. http://dojotoolkit.org/api/?qs=1.9/dijit/TooltipDialog
... View more
04-10-2014
09:54 AM
|
0
|
0
|
1465
|
|
POST
|
I have dealt with this before and unfortunately, both loadingMessage and noDataMessage are a bit vague. According to the dgrid documentation: loadingMessage An optional message to be displayed in the loading node which appears when a new page of results is requested. noDataMessage An optional message to be displayed when a query yields no results. It looks like loadingMessage will only trigger while the grid waits for new data to render and not while the data is loading. Since you are using an onDemandGrid, that will only happen if you scroll down really fast when using a gigantic dataset. It also looks like noDataMessage only displays when using a query with your dgrid, and that query returns null. However, if you set a query on the dgrid before your data is loaded, the noDataMessage will display. With this in mind, if you want to have a true loading indicator, you will have to use a combination of JS and CSS. This is easier than it sounds. I said earlier that the noDataMessage will show if you apply a query to your dgrid before the data is loaded. You can use this to your advantage. You can treat noDataMessage as a placeholder for your loading message (or set it to "" if you are going to use an image gif). The noDataMessage is contained in the following div: <div class="dgrid-no-data"></div> You can modify this div to be your loading indicator container. This is one I use on a personal site:
.dgrid-no-data {
background-image: url("../images/loaders/loading_blue.gif");
background-position: center center;
background-repeat: no-repeat;
height: 100%;
text-align: center;
width: 100%;
}
I've attached the image I use. *** Off topic but I wanted to make sure you set the idProperty on your store (the unique ID) so that dgrid can properly sort and query your data set. NOTE: the default value of idProperty is "id" so if that happens to be your uid field, then you can ignore this. var memStore = new Memory({ data: data, idProperty: "UNIQUE_ID_FIELD_GOES_HERE"}); Hope this helps, even if not exactly what you expected.
... View more
04-10-2014
09:43 AM
|
0
|
0
|
2443
|
|
POST
|
If you look at the console (which you should always do), you will see the following error message: "Error: Tried to register widget with id==tooltipDialog but that id is already registered" This means that you are trying to create a new tooltip without destroying the old one. Basically, you need to destroy the old tooltip before creating a new one.
... View more
04-10-2014
09:14 AM
|
0
|
0
|
1465
|
|
POST
|
Thanks for the feedback! According to the documentation, GraphicsLayer accepts an object that contains optional parameters. Although 'null' is an object according to typeof(), there are obviously no properties, but perhaps GraphicsLayer does not account for this particular use-case. Is there any particular reason you were passing null to GraphicsLayer? Otherwise, like you said, just don't pass null and follow the documentation.
// No optional params example
var graphicsLayer1 = new GraphicsLayer();
// Optional param example; opacity
var graphicsLayer2 = new GraphicsLayer({opacity:0.20});
... View more
04-10-2014
09:06 AM
|
0
|
0
|
2149
|
|
POST
|
The error where it says "Forbidden: Access is denied" leads me to believe there is a path issue either in the Javascript or with your IIS config. According to those error messages, your webserver is named "myserver"; is this correct? What do you see if you go to http://localhost/ ? Is it the same as http://myserver/ ? Do you see JSON on this page: http://myserver/DotNet/proxy.ashx?http://services.arcgisonline.com/ArcGIS/rest/services/?f=pjson
... View more
04-09-2014
10:57 AM
|
0
|
0
|
2569
|
|
POST
|
Hi Dale, Which proxy did you end up using? (Java, PHP or .NET) Were you able to confirm that the proxy is set up correctly? Using the .NET proxy as an example, you can confirm your proxy is set up correctly by accessing the following URL: http://[yourmachine]/DotNet/proxy.ashx?http://services.arcgisonline.com/ArcGIS/rest/services/?f=pjson This information is included in the README that comes with each proxy. Assuming this works, are there any error messages in the console? Using the Proxy Doc: https://developers.arcgis.com/javascript/jshelp/ags_proxy.html
... View more
04-08-2014
12:43 PM
|
0
|
0
|
2569
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-26-2014 09:56 AM | |
| 1 | 09-18-2014 11:50 AM | |
| 1 | 09-19-2014 11:28 AM | |
| 1 | 07-09-2014 01:43 PM | |
| 1 | 07-09-2014 02:05 PM |
| Online Status |
Offline
|
| Date Last Visited |
08-14-2024
05:31 PM
|