dorizo / jquery-option-tree

Automatically exported from code.google.com/p/jquery-option-tree
0 stars 0 forks source link

doesn't work with pure json arrays #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Many libraries will return JSON like below where multiple values appear in 
square brackets. Eg. ruby.

var option_tree = {
    "2004": [{"08":"2004-08"}],
    "2005": [{"04" : "2005-01", "07" : "2005-02"}]
  };

What is the expected output? What do you see instead?
You should only see 2 dropdowns. Instead you see 3.

What version of the product are you using? On what operating system?
jquery 1.7 and the latest version as of Jan 2012

Please provide any additional information below.

Original issue reported on code.google.com by gurpal2...@hotmail.com on 9 Jan 2012 at 2:19

GoogleCodeExporter commented 8 years ago
I don't know why these libraries would use that particular format as that 
one-element array enclosure is unnecessary. This should be fixed server side 
IMHO as the plugin requires certain documented input format. Is the server-side 
fix somehow impossible?

Original comment by kkotowicz on 9 Jan 2012 at 3:40

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I also think valid json input would benefit this plugin. It would also benefit 
in cases where pure js solution is needed. There are some tools to get json 
from objects, if this plugin does not accept json, additional manipulations are 
needed.

Original comment by henrijs....@gmail.com on 12 Mar 2012 at 2:04

GoogleCodeExporter commented 8 years ago
Plugin accepts json - in the provided case

{
    "2004": {"08":"2004-08"},
    "2005": {"04" : "2005-01", "07" : "2005-02"}
}

is the right format to use. You can safely produce that valid JSON server side 
and supply it to plugin via e.g. $.getJSON().

Original comment by kkotowicz on 12 Mar 2012 at 2:08