Skip to main content

Posts

Showing posts from 2016

ArcGIS Javascript API - Pinpoint a Geo-Location by Address

Problem: I needed a map embedded on a form I was working on to pinpoint a location onto an ArcGIS map.  As far as ArcGIS, there were plenty of examples using latitude and longitude, but no examples using a standard address. This project seemed easier than it really was. Solution: I’ve decided to use the Javasript API to solve this problem and it worked like a charm.  Those who are new to ArcGIS should find this post helpful if you want to simply point to a location using an address.  Let’s get right to the code. Code: This is just very basic markup to show what files to include and what form elements to use. HTML (index.html): <html> <head>     <link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css">     <style>         html, body, #myMap {             height: 400px;  ...

Easy Infinite Scroll Using jQuery

Problem: Loading a large record dataset on a page can slow down the app quite a bit.  How can I load a small number of records incrementally when the user scrolls to the end of the page? Solution: Infinite scrolling! Most Facebook users experience infinite scrolling as they scroll to view posts. This is made easy using jQuery. The Code: Consider this event handler:     $(window).scroll(function () {         if($(document).height() <= $(window).height()+300) {         }     }); If the height of the page reached the window height + 300 (or, scrolled to about 2/3 of the page), then do something.  In my case, I would make a service call for the next 3 records (assuming the record count on load was 3 records).  Let’s say, records 4 to 6.  Here’s the completed code: var currentPage = 1;   $ ( window ).scroll( function () {  ...