@james,
There is not a fixed schema for items in cascade. The json structure
is outside the scope of cascade. For smaller lists I might load some
javascript when the page hits and assign the 'url' as the var I gave
it. For larger lists or more complex objects I might just have an ajax
call for each list change event. It just depends. In either case, you
are simply dealing with individual items that simply need to answer
the predicate found in your 'match' option implementation as to
whether they should be hydrated into the child list or not.
Hope this helps
mike



Hey Mike...James here again.  Now that I've worked through some of the
basics, I would like to know how easy it would be to accommodate a
JSON file in a bit of a more efficient structure using arrays rather
than a simple value pairs.

IE.: You have designed around this structure:

{'when':'selectedValue','value':'itemValue','text':'itemText'}

Whereas after some testing, I've realized the data sizes would become
rather huge rather quickly.

I'm proposing a JSON structure such as:

{

   "Country1": [

       {

           "Region1": [

               "City1",

               "City2",

               "City3"

           ],

           "Region2": [

               "City1",

               "City2",

               "City3"

           ]

       }

   ]

}

The idea would be for a separate JSON file for each country (now that
we've got dynamic URLs working).  Of course this simplified structure
would require some parsing and reformatting to fit the structure you
have used for the .CASCADE plugin.

My problem is, since I'm so new to all this, I have no idea where in
the code to begin looking at how to take my imported JSON file, and
then do the work on it to change it into your format.

Could you offer some insight on this?

Thanks,

James

On Feb 2, 8:53 am, James <james.tilb...@gmail.com> wrote:
> @kelly
> Only then I would have to find a way to add some htmlEntitites
> decoding to the whole thing since I am accessing filenames directly...
>
> On Feb 2, 7:33 am, "kellyjandr...@sbcglobal.net"
>
> <kellyjandr...@sbcglobal.net> wrote:
> > You may have to write the special characters with their HTML
> > equivalent code. Is that not a possibility?
>
> > On Feb 1, 6:04 pm, James <james.tilb...@gmail.com> wrote:
>
> > > I did attach firebug at one point but couldn't glean anything useful
> > > from it.  From my google research, the problem has to do with the
> > > encoding (UTF-8) and JQuery's handling of special characters.  I can't
> > > explain why IE breaks while Firefox just displays a strange
> > > character...
>
> > > In any case, the solution to this is beyond me.
>
> > > For now it looks like I'm going to have to run my data through a
> > > function to replace accented characters with their "normal"
> > > counterparts.
>
> > > I'd be interested to hear from others about possible fixes to this
> > > though...
>
> > > On Feb 1, 4:13 pm, Mike Nichols <nichols.mik...@gmail.com> wrote:
>
> > > > have you attached fiddler and firebug to see what it happening?
>
> > > > On Feb 1, 10:14 am, James <james.tilb...@gmail.com> wrote:
>
> > > > > ...I must add and point out that the EXACT SAME DATA exists in the
> > > > > external file and the inline var.
>
> > > > > So it is ALSO very strange that the accents as mentioned display
> > > > > correctly in the first example (pulling from the inline var) and don't
> > > > > in the second example (pulling from the external file).
>
> > > > > I guess this helps to isolate where the problem is occuring?  Some
> > > > > parsing routine that only applies to externally-read files?
>
> > > > > On Feb 1, 12:10 pm, James <james.tilb...@gmail.com> wrote:
>
> > > > > > Update2:
>
> > > > > > The problematic page is still up as promised for discussion 
> > > > > > purposes,
> > > > > > but I have a breakthrough to report.
>
> > > > > > I never would have suspected this in a million years, but I 
> > > > > > discovered
> > > > > > it after following through with my same line of logic regarding the
> > > > > > JSON data causing a problem.
>
> > > > > > I eliminated single quotes and commas from the equation as these
> > > > > > worked just fine.  However, I thought I would try other characters
> > > > > > since I noticed that accented characters were showing up strangely 
> > > > > > in
> > > > > > the dropdown list (see under Quebec - Gaspé, for an example).  Where
> > > > > > it should say "GASPé", it instead shows "GASP(question mark inside a
> > > > > > diamond)".  Firefox displays this, IE doesn't display anything but 
> > > > > > the
> > > > > > loading circle graphic.
>
> > > > > > I can fix this by replacing all accented characters in my data with
> > > > > > regular alphabet characters, but the question is - why is this 
> > > > > > causing
> > > > > > a problem with the JQuery/IE combination?
>
> > > > > > I would much rather leave accented characters intact.  Something in
> > > > > > the JQuery routines can't handle these characters and/or is 
> > > > > > replacing
> > > > > > them with a strange character.
>
> > > > > > Any ideas?
>
> > > > > > On Feb 1, 11:46 am, James <james.tilb...@gmail.com> wrote:
>
> > > > > > > Update:
> > > > > > > It doesn't seem to have anything to do with single quotes or 
> > > > > > > commas,
> > > > > > > for that matter, inside the JSON data.
>
> > > > > > > Now HERE'S something to make you scratch your head:
>
> > > > > > > I have now put the complete data file back up in the external file
> > > > > > > ('CANADA_3.js') and I have ALSO put the EXACT same data file into 
> > > > > > > the
> > > > > > > static var included inline in the HTML page ('list3').
>
> > > > > > > This is the best demonstration of the problem:  The external file 
> > > > > > > and
> > > > > > > the static var both load fine if using Firefox.  Only the static 
> > > > > > > var
> > > > > > > works for IE.
>
> > > > > > > Live page (will not change until further 
> > > > > > > response):http://jamestilberg.com/jquery/
>
> > > > > > > James
>
> > > > > > > ?????
>
> > > > > > > On Feb 1, 11:22 am, James <james.tilb...@gmail.com> wrote:
>
> > > > > > > > @Mike
> > > > > > > > Thanks.  But it should have been working with the default code 
> > > > > > > > since
> > > > > > > > dropdown 2 was working - dropdown 3 used the exact same 
> > > > > > > > principle.
> > > > > > > > There is definitely something going on different between FF and 
> > > > > > > > IE.
>
> > > > > > > > Question - Could the existence of single quotes within the JSON 
> > > > > > > > data
> > > > > > > > throw off JQuery?  example: If one of the cities is 
> > > > > > > > "O'Brien"....
>
> > > > > > > > I ask because I have now put up a refined page with the two 
> > > > > > > > methods
> > > > > > > > and I have used a smaller version of the data file and guess 
> > > > > > > > what?  It
> > > > > > > > now works.  So this leads me to believe the JSON data itself 
> > > > > > > > may have
> > > > > > > > been causing a problem with IE only (Firefox always worked).
>
> > > > > > > >http://jamestilberg.com/jquery/
>
> > > > > > > > The thing is, I had already validated the JSON data with several
> > > > > > > > different online JSON validators....
>
> > > > > > > > I guess I need to build the JSON file back up and see if 
> > > > > > > > something
> > > > > > > > specific stumps JQuery...
>
> > > > > > > > On Feb 1, 2:01 am, Mike Nichols <nichols.mik...@gmail.com> 
> > > > > > > > wrote:
>
> > > > > > > > > @James
> > > > > > > > > Thinking about what you are doing here with the third 
> > > > > > > > > dropdown...By
> > > > > > > > > attaching that dropdown to the second you are telling it to be
> > > > > > > > > filtered by the second dropdown's selected value...which is 
> > > > > > > > > not
> > > > > > > > > selected yet since it just loaded so I would presume you 
> > > > > > > > > shouldn't
> > > > > > > > > have any data in the third drop down.
> > > > > > > > > To support this behavior in the past I used the 'event' 
> > > > > > > > > property of
> > > > > > > > > the options to define which event actually fires acascade( the
> > > > > > > > > defalt is 'changed'). Then I manually firecascadewithin the 
> > > > > > > > > parent
> > > > > > > > > element's change handler. :
> > > > > > > > >         //when 'make' is selected...
> > > > > > > > >         $(".seconddropdown")
> > > > > > > > >         .cascade(".firstdropdown",{
> > > > > > > > >                 ajax: 'firsturl.js'
> > > > > > > > >         })
> > > > > > > > >         .bind("change",function() {
> > > > > > > > >                 $(this).trigger("custom.changed");//manually 
> > > > > > > > > callcascade
> > > > > > > > >         });
>
> > > > > > > > >         $(".thirddropdown")
> > > > > > > > >         .cascade(".secondbehavior",{
> > > > > > > > >                 event : "custom.changed",//bind to custom 
> > > > > > > > > event to prevent loading
> > > > > > > > > fromcascade
> > > > > > > > >                 ajax: 'secondurl.js',
> > > > > > > > >         });
>
> > > > > > > > > On Jan 31, 4:39 pm, James <james.tilb...@gmail.com> wrote:
>
> > > > > > > > > > I am new to JQuery and your cascading dropdown was exactly 
> > > > > > > > > > what I was
> > > > > > > > > > looking for.  After formatting my data in JSON I have 
> > > > > > > > > > tested out the
> > > > > > > > > > Chained example 
> > > > > > > > > > (http://dev.chayachronicles.com/jquery/cascade/
> > > > > > > > > > index.html) and it ONLY WORKS in Firefox and NOT IE.
>
> > > > > > > > > > I am attempting to load the data from two external files, 
> > > > > > > > > > while your
> > > > > > > > > > example loads the second data set from a static var.
>
> > > > > > > > > > Is there a further step necessary to get this to work in IE?
>
> > > > > > > > > > I have my working example at:http://jamestilberg.com/jquery/
>
> > > > > > > > > > Any help would be appreciated!  :)

Reply via email to