Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <button class="btn btn-primary" id="btnAddPapel" onclick="adicionaPapeis();"><i class="fluigicon fluigicon-plus icon-xs"></i> Adicionar Partes</button>
- function inicializarAutoComplete(nomeDoCampo) {
- var operacoesAutoComplete = [];
- if (operacoesAutoComplete[nomeDoCampo] !== undefined) {
- operacoesAutoComplete[nomeDoCampo].destroy();
- operacoesAutoComplete[nomeDoCampo] = undefined;
- }
- var campos = ["colleagueName", "colleaguePK.colleagueId"];
- var operacoes = DatasetFactory.getDataset("colleague", campos, null, null).values;
- funcTemp = [];
- for (i = 0; i < operacoes.length; i++) {
- funcTemp.push(operacoes[i]["colleaguePK.colleagueId"] + "-" + operacoes[i]["colleagueName"]);
- }
- operacoesAutoComplete[nomeDoCampo] = FLUIGC.autocomplete(nomeDoCampo, {
- source: substringMatcher(funcTemp),
- name: 'funcionarios',
- minLength: 5,
- displayKey: 'description',
- allowDuplicates: false,
- hint: true,
- tagClass: 'tag-gray',
- type: 'autocomplete'
- });
- }
- function substringMatcher(strs) {
- return function findMatches(q, cb) {
- var matches, substrRegex;
- matches = [];
- substrRegex = new RegExp(q, 'i');
- $.each(strs, function (i, str) { if (substrRegex.test(str)) { matches.push({ description: str }); } }); cb(matches);
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement