Created
December 4, 2016 01:35
-
-
Save igorsgm/a295b9831afa7ec9afc18955196b1b76 to your computer and use it in GitHub Desktop.
Exemplo de função que irá append checkboxes em um seletor específico
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Carregar os checkboxes dos Resources (WS) | |
* @param data = as colunas da tabela, vindas do banco de dados | |
*/ | |
function loadColumnsCheckboxes(data) { | |
clearSelectbox('#jform_columns', '---', '#jform_table'); | |
columns = data.data[0]; | |
if (columns == false) { | |
js("#jform_columns").append('<option value="">Unloaded data</option>'); | |
} else { | |
js.each(columns, function (i) { | |
js("#jform_columns").append("<label for='jform_columns" + i + "' class='checkbox'><input type='checkbox' id='jform_columns" + i + "' name='jform[columns][]' value='" + columns[i].column + "'>" + columns[i].column + "</label>"); | |
}); | |
} | |
js("#jform_columns").trigger("liszt:updated"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment