Open pbalbino opened 5 years ago
I want to get all the rows in my grid, however, the "rows" property is empty:
My grid: `$("#telefone-telefoneManageGrid").bootgrid({ rowCount: [5], navigation: 2, labels: { infos: "Exibindo {{ctx.start}} até {{ctx.end}} de {{ctx.total}} registros.", loading: "Carregando...", noResults: "Não há dados para exibir!", refresh: "Atualizar", search: "Pesquisar" }, searchSettings: { delay: 100, characters: 2 }, css: { pagination: "pagination pagination-sm", search: "search form-group form-group-sm", actions: "actions btn-group btn-group-sm", dropDownMenu: "dropdown btn-group btn-group-sm", iconRefresh: "fa fa-refresh", iconDown: "fa fa-sort-amount-desc", iconUp: "fa fa-sort-amount-asc" }, ajaxSettings: { method: "POST", cache: false }, ajax: true, url: urlTelefoneGetSync, requestHandler: function (request) { request.fkTipoCadastro = $("#telefone-manage-FkTipoCadastro").val(); request.fkCadastro = $("#telefone-manage-FkCadastro").val(); return request; }, formatters: { "action": function (column, row) { return "   " + ""; }, "default": function (column, row) { return row[column.id] ? '' : ''; }, "phone": function (column, row) { if (row.Numero.length === 10) { var formatter10 = new StringMask("(00) 0000-0000", { reverse: true }); return formatter10.apply(row.Numero); } var formatter11 = new StringMask("(00) 00000-0000", { reverse: true }); return formatter11.apply(row.Numero); } } }).on("load.rs.jquery.bootgrid", function () { onOpenLoading('telefone-manage-rowgrid'); }).on("loaded.rs.jquery.bootgrid", function () { $(this).find("button[data-action='Update']") .on("click", function (e) { var rows = $("#telefone-telefoneManageGrid").bootgrid("getCurrentRows"); var id = $(this).data("id"); var row = rows.find(x => x.Id === id); if (row !== undefined) { if (row.Numero.length === 10) { $("#telefone-manage-Numero").inputmask({ mask: ["(99) 9999-9999", "(99) 99999-9999",], keepStatic: true, clearIncomplete: true }); } else { $("#telefone-manage-Numero").inputmask({ mask: ["(99) 99999-9999", "(99) 9999-9999",], keepStatic: true, clearIncomplete: true }); } $("#telefone-manage-Id").val(row.Id); $("#telefone-manage-FkTipoCadastro").val(row.FkTipoCadastro); $("#telefone-manage-FkCadastro").val(row.FkCadastro); $("#telefone-manage-FkTipoTelefone").val(row.FkTipoTelefone); $("#telefone-manage-Numero").val(row.Numero); $("#telefone-manage-Contato").val(row.Contato); $("#telefone-manage-Padrao").prop("checked", row.Padrao);
btnSubmitFormManageTelefone.html('<i class="fa fa-floppy-o" aria-hidden="true"></i> Salvar'); } }).end().find("button[data-action='Delete']") .on("click", function (e) { }); onCloseLoading('telefone-manage-rowgrid'); });`
Image:
As I'm trying to get all the rows: var rows = $("#telefone-telefoneManageGrid").bootgrid().data('.rs.jquery.bootgrid').rows;
var rows = $("#telefone-telefoneManageGrid").bootgrid().data('.rs.jquery.bootgrid').rows;
But "rows" is empty [].
I want to get all the rows in my grid, however, the "rows" property is empty:
My grid: `$("#telefone-telefoneManageGrid").bootgrid({ rowCount: [5], navigation: 2, labels: { infos: "Exibindo {{ctx.start}} até {{ctx.end}} de {{ctx.total}} registros.", loading: "Carregando...", noResults: "Não há dados para exibir!", refresh: "Atualizar", search: "Pesquisar" }, searchSettings: { delay: 100, characters: 2 }, css: { pagination: "pagination pagination-sm", search: "search form-group form-group-sm", actions: "actions btn-group btn-group-sm", dropDownMenu: "dropdown btn-group btn-group-sm", iconRefresh: "fa fa-refresh", iconDown: "fa fa-sort-amount-desc", iconUp: "fa fa-sort-amount-asc" }, ajaxSettings: { method: "POST", cache: false }, ajax: true, url: urlTelefoneGetSync, requestHandler: function (request) { request.fkTipoCadastro = $("#telefone-manage-FkTipoCadastro").val(); request.fkCadastro = $("#telefone-manage-FkCadastro").val(); return request; }, formatters: { "action": function (column, row) { return "   " + ""; }, "default": function (column, row) { return row[column.id] ? '' : ''; }, "phone": function (column, row) { if (row.Numero.length === 10) { var formatter10 = new StringMask("(00) 0000-0000", { reverse: true }); return formatter10.apply(row.Numero); } var formatter11 = new StringMask("(00) 00000-0000", { reverse: true }); return formatter11.apply(row.Numero); } } }).on("load.rs.jquery.bootgrid", function () { onOpenLoading('telefone-manage-rowgrid'); }).on("loaded.rs.jquery.bootgrid", function () { $(this).find("button[data-action='Update']") .on("click", function (e) { var rows = $("#telefone-telefoneManageGrid").bootgrid("getCurrentRows"); var id = $(this).data("id"); var row = rows.find(x => x.Id === id); if (row !== undefined) { if (row.Numero.length === 10) { $("#telefone-manage-Numero").inputmask({ mask: ["(99) 9999-9999", "(99) 99999-9999",], keepStatic: true, clearIncomplete: true }); } else { $("#telefone-manage-Numero").inputmask({ mask: ["(99) 99999-9999", "(99) 9999-9999",], keepStatic: true, clearIncomplete: true }); } $("#telefone-manage-Id").val(row.Id); $("#telefone-manage-FkTipoCadastro").val(row.FkTipoCadastro); $("#telefone-manage-FkCadastro").val(row.FkCadastro); $("#telefone-manage-FkTipoTelefone").val(row.FkTipoTelefone); $("#telefone-manage-Numero").val(row.Numero); $("#telefone-manage-Contato").val(row.Contato); $("#telefone-manage-Padrao").prop("checked", row.Padrao);
Image:![image](https://user-images.githubusercontent.com/25305220/46485726-a7f96880-c7d2-11e8-8522-e6801c849378.png)
As I'm trying to get all the rows:
var rows = $("#telefone-telefoneManageGrid").bootgrid().data('.rs.jquery.bootgrid').rows;
But "rows" is empty [].