Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 294241cf

Přidáno uživatelem Ondřej Fibich před asi 6 roky(ů)

Refs #1102: Fix order of values for selectable filters. Even if data were returned from DB in valid order the JavaScript object serialization caused that order was malformed due to usage of associative JavaScript arrays. Newly each value if stored as an array with 2 items (key, name). This new approach keeps the order. This does not fix just filters for cloud in members but all selectable filters in the system.

Zobrazit rozdíly:

application/libraries/Filter_form.php
if ($filter->values)
{
foreach ($filter->values as $key => $value)
$js_data[$filter->name]["values"][$key] = $value;
$js_data[$filter->name]["values"][] = array($key, $value);
}
else
$js_data[$filter->name]["values"] = '';
application/views/filter_form_template.php
b = ["<select name='" + name + "' class='v'>"];
for (var i in types[val]['values'])
{
b.push("<option value='"+i+"'>"+types[val]['values'][i]+"</option>");
b.push("<option value='"+types[val]['values'][i][0]+"'>"+types[val]['values'][i][1]+"</option>");
}
b.push("</select>");
// replace old input with select

Také k dispozici: Unified diff