Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order of returned items / updated documentation #44

Merged
merged 7 commits into from
Dec 15, 2012

Conversation

michaelperrin
Copy link

This is a pull request to fix the item order problem with Ajax Chosen as mentioned in #32 .

This fixes the problem for both grouped and non-grouped items but it breaks compatibility and it uses an other way to send data to Ajax Chosen: it has to be encapsulated in an object with value and text properties. However, the old format is still supported for backward compatibility purposes (but order is not kept in that case, as before).

The updated documentation (README.md file) is enclosed in this pull request and can be reviewed as well.

UPDATE: backward compatibility is now kept

@michaelperrin
Copy link
Author

I now made some changes so that backward compatibility is kept, which is much better!

You can now pass data like this (old format):

{"3": "Ohio"}

or this (new format):

[{"value": 3, "text": "Ohio"}]

For groups, the data can look like this (old format):

{"3": {
    group: true,
    text: "City",
    items: {
        "10": "Stockholm",
        "23": "Moskow"
    }
}

or this (new format):

[{
    group: true,
    text: "Europe",
    items: [
        { "value": "10", "text": "Stockholm" },
        { "value": "23", "text": "Moskow" }
    ]
}]

I kept the documentation with only the new format as there is no problem with order. This is therefore the recommended one.

@meltingice meltingice merged commit 35d9fac into meltingice:master Dec 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants