Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get all rows (ajax: true) #416

Open
pbalbino opened this issue Oct 4, 2018 · 0 comments
Open

Get all rows (ajax: true) #416

pbalbino opened this issue Oct 4, 2018 · 0 comments

Comments

@pbalbino
Copy link

pbalbino commented Oct 4, 2018

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 "&nbsp&nbsp&nbsp" +
"";
},
"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:
image

As I'm trying to get all the rows:
var rows = $("#telefone-telefoneManageGrid").bootgrid().data('.rs.jquery.bootgrid').rows;

But "rows" is empty [].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant