lorduakiti

action model fluig

May 31st, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         var buttons = new Array({
  2.             label: 'Salvar',
  3.             type: 'success',
  4.             autoClose: false
  5.         }, {
  6.                 label: 'Fechar',
  7.                 type: 'default',
  8.                 autoClose: true
  9.             });
  10.         MyDataTable.openModal('modalEdit', title, MyDataTable.modalHtml, 'full', buttons);
  11. --------------------------------
  12.     openModal: function (id, title, content, size, buttons) {
  13.         this.size = ((size == undefined) ? 'large' : size); //NOTE: full | large | small
  14.         this.actions = new Array();
  15.         if (buttons != null && buttons.length > 0) {
  16.             for (var i = 0; i < buttons.length; i++) {
  17.                 this.actions.push({
  18.                     'label': buttons[i].label,
  19.                     'bind': 'data-open-' + (buttons[i].label.replace(' ', '-')).toLowerCase(),
  20.                     'classType': 'btn-' + buttons[i].type,
  21.                     'autoClose': buttons[i].autoClose
  22.                 });
  23.             }
  24.         } else if (buttons != null) {
  25.             this.actions.push({
  26.                 'label': 'Cancelar',
  27.                 'bind': 'data-open-cancelar',
  28.                 'classType': 'btn-danger',
  29.                 'autoClose': true
  30.             });
  31.         } else {
  32.             this.actions.push({
  33.                 'label': 'Fechar',
  34.                 'bind': 'data-open-fechar',
  35.                 'classType': 'btn-primary',
  36.                 'autoClose': true
  37.             });
  38.         }
  39.         if (_global.modal[id] != undefined) {
  40.             _global.modal[id].remove();
  41.         }
  42.         _global.modal[id] = FLUIGC.modal({
  43.             title: title,
  44.             content: content,
  45.             id: 'fluig-modal',
  46.             size: this.size,
  47.             actions: this.actions
  48.         }, function (err, data) {
  49.             if (err) {
  50.                 // do error handling
  51.             } else {
  52.                 // do something with data
  53.             }
  54.         });
  55.     },
Advertisement
Add Comment
Please, Sign In to add comment