POST
|
I was able to see the datagrid through debugging too. I tried to pause before and after the grid.setStore like so:
// Show modal
$("#myModal").modal("show");
var grid = registry.byId("grid");
window.setTimeout(function () { }, 5000);
grid.setStore(store);
window.setTimeout(function () { }, 5000); but that didn't do anything.
... View more
07-31-2015
01:25 PM
|
0
|
0
|
1422
|
POST
|
That's actually what it was in my original code in my application. I am not sure why it's missing here, but I don't think I need it.
... View more
07-31-2015
12:55 PM
|
0
|
0
|
1496
|
POST
|
That was added in when I was at the UC. I commented it out. It appears to have no value.
... View more
07-31-2015
12:46 PM
|
0
|
2
|
1496
|
POST
|
I tried this block, but it does not seem to do anything.
... View more
07-31-2015
12:16 PM
|
0
|
0
|
1496
|
POST
|
I am using this sample here: http://www.w3schools.com/bootstrap/bootstrap_modal.asp to attempt to create a bootstrap dialog box. The only problem is I can't get the dojo grid to display inside of my modal dialog box. What am I doing wrong? Here is my code with references as to where I am trying to display the modal and the grid. <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://js.arcgis.com/3.14/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.14/dojox/grid/resources/Grid.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.14/dojox/grid/resources/claroGrid.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<title></title>
<style>
#myModal {
height:80%;
}
</style>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
var dojoConfig = {
parseOnLoad: true,
isDebug: true,
locale: 'en-us',
extraLocale: ['ja-jp']
};
</script>
<!-- This will not work if you set the html lang https://community.esri.com/thread/81475 -->
<script src="http://js.arcgis.com/3.14/"></script>
<style>
.modal-body, #grid
{
height:500px;
}
</style>
</head>
<body class="claro">
<label id="lblOwnerAddress" for="ownerAddress">Owner's Address</label>
<input type="text" id="ownerAddress" name="ownerAddress" value="111 S Main" />
<div class="container">
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<table data-dojo-type="dojox/grid/DataGrid" data-dojo-id="grid" id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'">
<thead>
<tr>
<th field="address" width="200px">Address</th>
<!--<th field="score">Scrore</th>-->
</tr>
</thead>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<script>
var items;
require([
"dojo/on",
"dojo/_base/array",
"esri/tasks/locator",
"dojox/grid/DataGrid",
"dojo/data/ItemFileReadStore",
"dijit/registry", "dojo/parser",
"dijit/layout/ContentPane",
"dojo/domReady!"
],
function (on, arrayUtils, Locator, DataGrid, ItemFileReadStore, registry, parser) {
parser.parse();
document.getElementById("grid").style.display = "none";
on(document.getElementById('ownerAddress'), 'focusout', checkAddress);
function checkAddress() {
var locator = new Locator("http://maps.decaturil.gov/arcgis/rest/services/Public/WebAddressLocator/GeocodeServer");
//console.log(document.getElementById('ownerAddress').value);
var node = document.getElementById('ownerAddress');
// according to your service it takes Single Line
var params = {
"Single Line Input": node.value
};
locator.addressToLocations(params).then(function (addressCandidates) {
//console.log('success', addressCandidates);
//console.log(addressCandidates.length);
if (addressCandidates.length > 1) {
for (a = 0; a < addressCandidates.length; a++) {
// This is the address that should go into a grid cell
console.log(addressCandidates.address);
}
console.log(addressCandidates);
items = arrayUtils.map(addressCandidates, function (result) {
console.log(result);
return result;
});
console.log(items);
}
var data = {
items: items
};
console.log("Log" + data);
store = new ItemFileReadStore({
data: data
});
// display grid
document.getElementById("grid").style.display = "block";
// Show modal
$("#myModal").modal("show");
var grid = registry.byId("grid");
grid.setStore(store);
//registry.byId("grid").display=block;
grid.on("rowclick", onRowClickHandler);
//console.log(addressCandidates.length);
var adresses = addressCandidates.map(function {
return x.address;
});
//console.log(adresses);
}).otherwise(function (err) {
console.log('somethings wrong', err);
});
}
function onRowClickHandler(evt) {
console.log(evt);
var clickedAddress = evt.grid.getItem(evt.rowIndex).address;
console.log(clickedAddress);
alert(clickedAddress);
// console.log(evt.explicitOriginalTarget.data);
}
});
</script>
</body>
</html>
... View more
07-31-2015
11:57 AM
|
0
|
19
|
9058
|
POST
|
I'm actually using AMD myself, but I didn't know if there was a way to keep that line in. I had to take out the language tag too.
... View more
07-31-2015
09:28 AM
|
0
|
0
|
243
|
POST
|
I am going off this example: Show find task results in a DataGrid | ArcGIS API for JavaScript And this appears to be the block of code that I need to populate my grid with the exception of the rowclick handler: //Create data store and bind to grid.
store = new ItemFileReadStore({
data : data
});
var grid = registry.byId("grid");
grid.setStore(store);
grid.on("rowclick", onRowClickHandler); I want to populate my address candidates that are found here: if (addressCandidates.length > 1) {
for (a = 0; a < addressCandidates.length; a++) {
// This is the address that should go into a grid cell
console.log(addressCandidates.address);
}
} This code loops through to obtain each address candidate. I would like to bind the address candidate to the grid as I loop through the code. How do I do that? Here is the complete code: JS Bin - Collaborative JavaScript Debugging
... View more
07-31-2015
06:50 AM
|
0
|
0
|
1954
|
POST
|
I want to place my address candidates in a grid that is created on the fly. I want to then allow the user to be able to click on one of the address candidates in the list and display that in the address candidate that was clicked in the console. I've looked here and this looks like what I want, but it also looks like too much. I am not sure what I could take out: Show find task results in a DataGrid | ArcGIS API for JavaScript I have also looked here: dojox.grid.DataGrid — The Dojo Toolkit - Reference Guide My code will not run correctly in JSBin. I have done my testing in Google Chrome. Here is my code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://js.arcgis.com/3.14/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css">
<title></title>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<label id="lblOwnerAddress" for="ownerAddress">Owner's Address</label>
<input type="text" id="ownerAddress" name="ownerAddress" value="111 S Main" />
<script src="http://js.arcgis.com/3.14/"></script>
<script>
require([
'dojo/on',
'esri/tasks/locator'
],
function (on, Locator) {
on(document.getElementById('ownerAddress'), 'focusout', checkAddress);
function checkAddress() {
var locator = new Locator("http://maps.decaturil.gov/arcgis/rest/services/Public/WebAddressLocator/GeocodeServer");
//console.log(document.getElementById('ownerAddress').value);
var node = document.getElementById('ownerAddress');
// according to your service it takes Single Line
var params = {
"Single Line Input": node.value
};
locator.addressToLocations(params).then(function (addressCandidates) {
//console.log('success', addressCandidates);
//console.log(addressCandidates.length);
if (addressCandidates.length > 1) {
for (a = 0; a < addressCandidates.length; a++) {
// This is the address that should go into a grid cell
console.log(addressCandidates.address);
}
}
//console.log(addressCandidates.length);
var adresses = addressCandidates.map(function {
return x.address;
});
//console.log(adresses);
}).otherwise(function (err) {
console.log('somethings wrong', err);
});
}
});
</script>
</body>
</html>
... View more
07-30-2015
12:10 PM
|
0
|
3
|
3217
|
POST
|
I feel brilliant now. I did not click on the dropdown. Thanks.
... View more
07-30-2015
11:58 AM
|
0
|
0
|
565
|
POST
|
That is a pain going back and forth for sharing code, but I will keep it in mind. Thanks.
... View more
07-30-2015
11:56 AM
|
0
|
0
|
330
|
POST
|
I went to that page. I still don't see the beta available for download, just 3.14.
... View more
07-30-2015
11:55 AM
|
0
|
2
|
565
|
POST
|
I have an input box that the user enters an address into. I want to then check the locator service and see if the address is in there. If the address is in the locator service, I don't want to do anything, but if the address is not in the locator service, I want the locator service to provide the alternatives as a list. The score for the locator service is already set. My updated code is here: JS Bin - Collaborative JavaScript Debugging Right now the code just returns the address that is in the input box. There should be two alternatives. Any idea why these aren't showing Rene Rubalcava? I copied the code from the sample we worked on.
... View more
07-30-2015
09:30 AM
|
0
|
2
|
2078
|
Title | Kudos | Posted |
---|---|---|
1 | 06-24-2015 06:06 AM | |
1 | 07-15-2015 12:34 PM | |
1 | 02-26-2015 12:31 PM | |
1 | 05-21-2015 02:27 PM | |
1 | 07-13-2015 09:18 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|