datatables with jeditable plugin - sorting dropdown list

datatables with jeditable plugin - sorting dropdown list

mangiamangia Posts: 6Questions: 0Answers: 0
edited September 2013 in General
Hello

Sorry for this but I couldn't find answer on forum.

I'm using datatables (1.9.3) with jeditable plugin.

Drop down list in table is defined with:

[code]
{
tooltip: 'Click to select',
loadtext: 'loading...',
type: 'select',
onblur: 'cancel',
submit: 'Ok',
loadurl: 'link.php?action=getList',
loadtype: 'GET',
sUpdateURL: "link.php?action=quickEdit"
}
[/code]

The php sends back id and name columns sorted by name (I wanted this way)

{'236':'AAA','228':'BBBB','155':'CCC','156':'DDD','120':'EEE','12':'MMMM'}

but in drop down list I have sorted by id, ascending.

MMMM
EEE
CCC
DDD
BBBB
AAA

which isn't usable when you have many options

Does anyone has any clue why this happens and which script does resorting ?

Replies

  • mangiamangia Posts: 6Questions: 0Answers: 0
    Here we go again... The problem was not in jeditable or datatables... The browser sorts this JSON by key (which is integer)

    The solution is to echo JSON in next format
    {'_236':'AAA','_228':'BBBB','_155':'CCC','_156':'DDD','_120':'EEE','_12':'MMMM'}

    Of course, the _ char can be replaced with any other non number char. The goal is to avoid integer keys.
This discussion has been closed.