Select to view content in your preferred language

Relationship Query ??? Legacy to AMD

2008
10
10-17-2013 04:47 PM
NumaGremling
Deactivated User
Hi everyone,

I am trying to use a relationship query in my application. About 5 months ago I had never used HTML, CSS or JavaScript, so I am very dependent on the provided samples. The only provided AMD sample has a lot of additional stuff and gets complicated quickly for me, and therefore I have tackled a legacy sample ??? I even get it to work. Translating the script into AMD is my next step, but it turns out to be harder than expected.

OK, so I have reduced my 600-line code to about 200 lines. Once I get that working I will add the previous stuff again. I am attaching two scripts, the first one (QueryRelatedWORKING) is in legacy mode and it is able to correctly query my table (click on a parcel ??? display a table). If I had a one-to-one translation of that script into AMD I would be more than happy. The second one (QueryRelatedTRANSLATE) is my attempt to translate into AMD. Viewing both codes next to each other is perhaps the easiest way to detect problems.

I added //OK to lines in the original script that I am pretty sure I translated correctly. If I was unsure, ran into issues, or have questions I left a comment saying so.

My biggest issue (and maybe solution to a lot of it) is that I am not sure where to import things in the beginning statements before you start coding. What I mean is :

require(
["esri/map",
"esri/a",
"esri/b",
"esri/c",
],
function(Map, a, b, c){
var map = new Map
var ??? = new a
var ??? = new b

etc. etc.

The way it works, I read, is that you have to mention things in the correct order. Which is fine in a simple application but once it gets complicated that becomes impossible for a beginner, especially when dojo is thrown into that (which I am not familiar with). For example, what happens if I use things twice? And where do I put the dojo stuff? Can I mix dojo, dijit, and dojox? Looking at samples I???d say I need to put the esri stuff first and then the dojo stuff, but ordering within dojo becomes complex quite fast.

Again, I am a beginner so please point out even the most obvious mistakes. Any advice and correction is greatly appreciated 🙂

PS: I???d be happy to post both scripts in here as well, but if I remember correctly from what I read a while ago one should not post long codes.
0 Kudos
10 Replies
NumaGremling
Deactivated User
which exact statement?  there are four there :).

i can't really debug from here without access to your services



You are right, hehe; should have clarified that! Apparently it just stops running right after the last bracket.

I am a student at the University of Redlands and we do not have the ability to make services public, but I will check with someone tomorrow; that would make things so much easier.

For the time being I will attach the latest script, just to make sure we are looking at the same one.

One thing I was wondering, is if the word grid might be causing issues.

For example:

<table data-dojo-type="dojox/grid/DataGrid" jsid="grid" id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'" style="height:300px; width:300px;">


jsid, and id are both grid? I had to look up what jsid means means, and it looks like I might have to change that to data-dojo-id anyways.
0 Kudos