Commit 01905776fbf348574dabeb615399305f25fa93e4
1 parent
c8e40800
Exists in
master
and in
7 other branches
Ordenação da lista de valores no utilitario que gera um combo de valores
Showing
2 changed files
with
6 additions
and
3 deletions
Show diff stats
classesjs/classe_util.js
... | ... | @@ -1874,16 +1874,20 @@ i3GEO.util = |
1874 | 1874 | $i(onde).innerHTML = "<span style=color:red;font-size:10px; >buscando valores...</span>"; |
1875 | 1875 | } |
1876 | 1876 | var monta = function(retorno) { |
1877 | - var ins = [], i, pares, j; | |
1877 | + var ins = [], i, pares, j, valoresSort = []; | |
1878 | 1878 | if (retorno.data !== undefined) { |
1879 | 1879 | ins.push("<select id=" + id + " >"); |
1880 | 1880 | ins.push("<option value='' >---</option>"); |
1881 | 1881 | for (i = 0; i < retorno.data[1].registros.length; i++) { |
1882 | 1882 | pares = retorno.data[1].registros[i].valores; |
1883 | 1883 | for (j = 0; j < pares.length; j++) { |
1884 | - ins.push("<option value='" + pares[j].valor + "' >" + pares[j].valor + "</option>"); | |
1884 | + valoresSort.push(pares[j].valor); | |
1885 | 1885 | } |
1886 | 1886 | } |
1887 | + valoresSort.sort(); | |
1888 | + for (j = 0; j < valoresSort.length; j++) { | |
1889 | + ins.push('<option value="' + valoresSort[j] + '" >' + valoresSort[j] + '</option>'); | |
1890 | + } | |
1887 | 1891 | ins.push("</select>"); |
1888 | 1892 | ins = ins.join(''); |
1889 | 1893 | temp = { | ... | ... |
ferramentas/selecao/index.js
... | ... | @@ -1013,7 +1013,6 @@ i3GEOF.selecao = { |
1013 | 1013 | interrogacao.onclick = function(){ |
1014 | 1014 | var obj = (this.parentNode.parentNode.getElementsByTagName("input"))[0], |
1015 | 1015 | itemTema = (this.parentNode.parentNode.getElementsByTagName("select"))[0].value; |
1016 | - //FIXME ordenar a lista de valores e remover apostrofe | |
1017 | 1016 | i3GEO.util.comboValoresItem( |
1018 | 1017 | "i3GEOselecaocbitens", |
1019 | 1018 | i3GEO.temaAtivo, | ... | ... |