Fórum Datatables Editor, Adicionar Etapas via modal #602371

14/05/2019

0

estou tentando criar um modal onde segue um fluxo de edição de dados, porem não consigo nem o mesmo manipular os botões do modal gerado pelo datatable.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
$('#btnfiltrar').on('click', function() {
    tableCliente.ajax.reload();
});
 
var editortableClienteNew = new $.fn.dataTable.Editor({
    ajax: BASE_URL + "/ajaxClientes/buscaClientes",
    table: "#tableCliente",
    fields: [{
                    label: 'Nome Completo:',
                    name: 'Cliente.Nome',
                    type: 'text'
            },
            {
                    label: "CodiNome:",
                    name: "Cliente.CodiNome",
                    type: "text"
            },
            {
                    label: "Data Nascimento:",
                    name: "Cliente.DataNasc",
                    type: 'datetime',
                    keyInput: true,
                    format: 'DD/MM/YYYY',
                    attr: {
                            autocomplete: "off"
                    },
                    opts: {
                            yearRange: 100,
                            maxDate: new Date()
                    }
            },         
            {
                    label: "Sexo",
                    name: "Cliente.Sexo",
                    type: "select",
                    options: [{
                                    label: "Masculino",
                                    value: "0"
                            },
                            {
                                    label: "Feminino",
                                    value: "1"
                            }
                    ]
            },
            {
                    label: 'Indicante:',
                    fieldInfo: 'Busque o cliente para ser indicante através do seu nome.',
                    name: 'Cliente.IndicanteID',
                    type: 'selectize',
                    opts: {
                            labelField: 'label',
                            valueField: 'value',
                            load: function(query, callback) {
                                    if (!query.length)
                                            return callback();
 
                                    $.ajax({
                                            url: BASE_URL + '/ajaxEquipe/buscaAutoCompleteClientes',
                                            type: 'POST',
                                            dataType: 'json',
                                            data: {
                                                    'term': query
                                            },
                                            success: function(res) {
                                                    callback(res);
                                            },
                                            error: function() {
                                                    callback();
                                            }
                                    });
                            }
                    }
            }
    ]
});
 
var editortableClientePessoais = new $.fn.dataTable.Editor({
    ajax: BASE_URL + "/ajaxClientes/buscaClientes",
    table: "#tableCliente",
    fields: [{
                    label: 'Nome Completo:',
                    name: 'Cliente.Nome',
                    type: 'text',
            },
            {
                    label: 'CodiNome:',
                    name: 'Cliente.CodiNome',
                    type: 'text',
                    attr: {
                            maxlength: 11
                    },
            },
            {
                    label: "Sexo",
                    name: "Cliente.Sexo",
                    type: "select",
                    options: [{
                                    label: "Masculino",
                                    value: "0"
                            },
                            {
                                    label: "Feminino",
                                    value: "1"
                            }
                    ]
            },
            {
                    label: "Data Nascimento:",
                    name: "Cliente.DataNasc",
                    type: 'datetime',
                    keyInput: true,
                    format: 'DD/MM/YYYY',
                    attr: {
                            autocomplete: "off"
                    },
                    opts: {
                            yearRange: 100,
                            maxDate: new Date()
                    }
            },
            {
                    name: 'ClienteDados.ClienteID',
                    type: 'hidden'
            },
            {
                    label: "CPF:",
                    name: "ClienteDados.CPF",
                    attr: {
                            maxlength: 11
                    },
                    type: "mask",
                    mask: "000.000.000-00",
                    maskOptions: {
                            reverse: true,
                            placeholder: "000.000.000-00"
                    }
            },
            {
                    label: "RG:",
                    name: "ClienteDados.RG",
                    type: "mask",
                    mask: "00.000.000-0",
                    maskOptions: {
                            reverse: true,
                            placeholder: "00.000.000-0"
                    },
                    attr: {
                            maxlength: 12
                    }
            },
            {
                    label: "E-mail:",
                    name: "ClienteDados.Email1",
                    type: "text",
                    attr: {
                            maxlength: 50
                    }
            },
            {
                    label: "Telefone Residencial:",
                    name: "ClienteDados.Telefone1",
                    attr: {
                            maxlength: 10
                    },
                    type: "mask",
                    mask: "00 0000-0000",
                    maskOptions: {
                            reverse: true,
                            placeholder: "00 0000-0000"
                    }
            },
            {
                    label: "Telefone Celular:",
                    name: "ClienteDados.Telefone2",
                    attr: {
                            maxlength: 11
                    },
                    type: "mask",
                    mask: "00 00000-0000",
                    maskOptions: {
                            reverse: true,
                            placeholder: "00 00000-0000"
                    }
            },
            {
                    label: 'Nome da Mãe:',
                    name: 'ClienteDados.NomeMae',
                    type: 'text',
            },
            {
                    label: 'Nome do Pai:',
                    name: 'ClienteDados.NomePai',
                    type: 'text',
            },
            {
                    label: 'Religião:',
                    name: 'ClienteDados.ReligiaoID',
                    type: 'select',
 
            },
            {
                    label: 'Nome do conjuge:',
                    name: 'ClienteDados.NomeConjuge',
                    type: 'text',
            },
            {
                    label: 'Indicante:',
                    fieldInfo: 'Busque o cliente para ser indicante através do seu nome.',
                    name: 'Cliente.IndicanteID',
                    type: 'selectize',
                    opts: {
                            labelField: 'label',
                            valueField: 'value',
                            load: function(query, callback) {
                                    if (!query.length)
                                            return callback();
 
                                    $.ajax({
                                            url: BASE_URL + '/ajaxEquipe/buscaAutoCompleteClientes',
                                            type: 'POST',
                                            dataType: 'json',
                                            data: {
                                                    'term': query
                                            },
                                            success: function(res) {
                                                    callback(res);
                                            },
                                            error: function() {
                                                    callback();
                                            }
                                    });
                            }
                    }
            }
    ]
});
var tableCliente = $('#tableCliente').DataTable({
    processing: false,
    responsive: true,
    paging: true,
    searching: false,
    dom: "Bfrtip",
    order: [
            [0, 'asc']
    ],
    select: true,
    ajax: {
            "url": BASE_URL + "/ajaxClientes/buscaClientes",
            "type": "POST",
            "data": function(d) {
                    return $('#frmSearchNomeCliente').serialize();
            }
    },
    columns: [{data: 'Cliente.Nome'},
            {data: 'Cliente.CodiNome'},
            {data: 'Cliente.DataNasc'},
            {"data": "Cliente.Sexo",
                render: function(data, type, row) {
                    return data == 1 ? "Feminino" : "Masculino";
                }
            },
            {data: 'CL.Nome'},
            {data: 'CL2.Nome'}
    ],
    buttons: [
            {
                    extend: "create",
                    text: "Novo",
                    editor: editortableClienteNew
            },
            {
                    extend: "edit",
                    text: "Dados",
                    editor: editortableClientePessoais
            },
            {
                    extend: "edit",
                    text: "Profissão",
                    editor: editortableClienteProfissao
            },
            {
                    extend: "edit",
                    text: "Endereço",
                    editor: editortableClienteEndereco
            },
            {
                    extend: "edit",
                    text: "Treinamento",
                    editor: editortableClienteTreinamento
            }
             
             
    ]
});
 
editortableCliente.on('postSubmit', function(e, json, data) {
    tableCliente.ajax.reload();
 
});


[image]
https://i.stack.imgur.com/Puu1s.png
[/image]

gostaria de adicionar no rodapé um botão onde conseguiria chamar as outras modais, ou que poderia adicionar os botões como abas dentro do modal para fazer as modificações
Guilherme Bitencourt

Guilherme Bitencourt

Responder

Posts

20/05/2019

William Nascimento

estou tentando criar um modal onde segue um fluxo de edição de dados, porem não consigo nem o mesmo manipular os botões do modal gerado pelo datatable.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
$('#btnfiltrar').on('click', function() {
    tableCliente.ajax.reload();
});
 
var editortableClienteNew = new $.fn.dataTable.Editor({
    ajax: BASE_URL + "/ajaxClientes/buscaClientes",
    table: "#tableCliente",
    fields: [{
                    label: 'Nome Completo:',
                    name: 'Cliente.Nome',
                    type: 'text'
            },
            {
                    label: "CodiNome:",
                    name: "Cliente.CodiNome",
                    type: "text"
            },
            {
                    label: "Data Nascimento:",
                    name: "Cliente.DataNasc",
                    type: 'datetime',
                    keyInput: true,
                    format: 'DD/MM/YYYY',
                    attr: {
                            autocomplete: "off"
                    },
                    opts: {
                            yearRange: 100,
                            maxDate: new Date()
                    }
            },         
            {
                    label: "Sexo",
                    name: "Cliente.Sexo",
                    type: "select",
                    options: [{
                                    label: "Masculino",
                                    value: "0"
                            },
                            {
                                    label: "Feminino",
                                    value: "1"
                            }
                    ]
            },
            {
                    label: 'Indicante:',
                    fieldInfo: 'Busque o cliente para ser indicante através do seu nome.',
                    name: 'Cliente.IndicanteID',
                    type: 'selectize',
                    opts: {
                            labelField: 'label',
                            valueField: 'value',
                            load: function(query, callback) {
                                    if (!query.length)
                                            return callback();
 
                                    $.ajax({
                                            url: BASE_URL + '/ajaxEquipe/buscaAutoCompleteClientes',
                                            type: 'POST',
                                            dataType: 'json',
                                            data: {
                                                    'term': query
                                            },
                                            success: function(res) {
                                                    callback(res);
                                            },
                                            error: function() {
                                                    callback();
                                            }
                                    });
                            }
                    }
            }
    ]
});
 
var editortableClientePessoais = new $.fn.dataTable.Editor({
    ajax: BASE_URL + "/ajaxClientes/buscaClientes",
    table: "#tableCliente",
    fields: [{
                    label: 'Nome Completo:',
                    name: 'Cliente.Nome',
                    type: 'text',
            },
            {
                    label: 'CodiNome:',
                    name: 'Cliente.CodiNome',
                    type: 'text',
                    attr: {
                            maxlength: 11
                    },
            },
            {
                    label: "Sexo",
                    name: "Cliente.Sexo",
                    type: "select",
                    options: [{
                                    label: "Masculino",
                                    value: "0"
                            },
                            {
                                    label: "Feminino",
                                    value: "1"
                            }
                    ]
            },
            {
                    label: "Data Nascimento:",
                    name: "Cliente.DataNasc",
                    type: 'datetime',
                    keyInput: true,
                    format: 'DD/MM/YYYY',
                    attr: {
                            autocomplete: "off"
                    },
                    opts: {
                            yearRange: 100,
                            maxDate: new Date()
                    }
            },
            {
                    name: 'ClienteDados.ClienteID',
                    type: 'hidden'
            },
            {
                    label: "CPF:",
                    name: "ClienteDados.CPF",
                    attr: {
                            maxlength: 11
                    },
                    type: "mask",
                    mask: "000.000.000-00",
                    maskOptions: {
                            reverse: true,
                            placeholder: "000.000.000-00"
                    }
            },
            {
                    label: "RG:",
                    name: "ClienteDados.RG",
                    type: "mask",
                    mask: "00.000.000-0",
                    maskOptions: {
                            reverse: true,
                            placeholder: "00.000.000-0"
                    },
                    attr: {
                            maxlength: 12
                    }
            },
            {
                    label: "E-mail:",
                    name: "ClienteDados.Email1",
                    type: "text",
                    attr: {
                            maxlength: 50
                    }
            },
            {
                    label: "Telefone Residencial:",
                    name: "ClienteDados.Telefone1",
                    attr: {
                            maxlength: 10
                    },
                    type: "mask",
                    mask: "00 0000-0000",
                    maskOptions: {
                            reverse: true,
                            placeholder: "00 0000-0000"
                    }
            },
            {
                    label: "Telefone Celular:",
                    name: "ClienteDados.Telefone2",
                    attr: {
                            maxlength: 11
                    },
                    type: "mask",
                    mask: "00 00000-0000",
                    maskOptions: {
                            reverse: true,
                            placeholder: "00 00000-0000"
                    }
            },
            {
                    label: 'Nome da Mãe:',
                    name: 'ClienteDados.NomeMae',
                    type: 'text',
            },
            {
                    label: 'Nome do Pai:',
                    name: 'ClienteDados.NomePai',
                    type: 'text',
            },
            {
                    label: 'Religião:',
                    name: 'ClienteDados.ReligiaoID',
                    type: 'select',
 
            },
            {
                    label: 'Nome do conjuge:',
                    name: 'ClienteDados.NomeConjuge',
                    type: 'text',
            },
            {
                    label: 'Indicante:',
                    fieldInfo: 'Busque o cliente para ser indicante através do seu nome.',
                    name: 'Cliente.IndicanteID',
                    type: 'selectize',
                    opts: {
                            labelField: 'label',
                            valueField: 'value',
                            load: function(query, callback) {
                                    if (!query.length)
                                            return callback();
 
                                    $.ajax({
                                            url: BASE_URL + '/ajaxEquipe/buscaAutoCompleteClientes',
                                            type: 'POST',
                                            dataType: 'json',
                                            data: {
                                                    'term': query
                                            },
                                            success: function(res) {
                                                    callback(res);
                                            },
                                            error: function() {
                                                    callback();
                                            }
                                    });
                            }
                    }
            }
    ]
});
var tableCliente = $('#tableCliente').DataTable({
    processing: false,
    responsive: true,
    paging: true,
    searching: false,
    dom: "Bfrtip",
    order: [
            [0, 'asc']
    ],
    select: true,
    ajax: {
            "url": BASE_URL + "/ajaxClientes/buscaClientes",
            "type": "POST",
            "data": function(d) {
                    return $('#frmSearchNomeCliente').serialize();
            }
    },
    columns: [{data: 'Cliente.Nome'},
            {data: 'Cliente.CodiNome'},
            {data: 'Cliente.DataNasc'},
            {"data": "Cliente.Sexo",
                render: function(data, type, row) {
                    return data == 1 ? "Feminino" : "Masculino";
                }
            },
            {data: 'CL.Nome'},
            {data: 'CL2.Nome'}
    ],
    buttons: [
            {
                    extend: "create",
                    text: "Novo",
                    editor: editortableClienteNew
            },
            {
                    extend: "edit",
                    text: "Dados",
                    editor: editortableClientePessoais
            },
            {
                    extend: "edit",
                    text: "Profissão",
                    editor: editortableClienteProfissao
            },
            {
                    extend: "edit",
                    text: "Endereço",
                    editor: editortableClienteEndereco
            },
            {
                    extend: "edit",
                    text: "Treinamento",
                    editor: editortableClienteTreinamento
            }
             
             
    ]
});
 
editortableCliente.on('postSubmit', function(e, json, data) {
    tableCliente.ajax.reload();
 
});


[image]
https://i.stack.imgur.com/Puu1s.png
[/image]

gostaria de adicionar no rodapé um botão onde conseguiria chamar as outras modais, ou que poderia adicionar os botões como abas dentro do modal para fazer as modificações

Ler Mais...



Olá Guilherme, acho que você está procurando algo como isso, aqui:
, um modal step-by-step
Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar