Ok so I need to access the value from a function (which is defined elsewhere) that is returning a promise. Here’s the full code in js. Where I need to display it is inside <<>>
. Basically I can seem to access it directly because the GetFilialLogada function is returning a promise. Sorry for it being a mess.
<code>var dataTable = $('#AlteraStatusPedTable').DataTable(
abp.libs.datatables.normalizeConfiguration({
serverSide: true,
paging: true,
order: [[1, "desc"]],
searching: false,
scrollX: true,
//https://docs.abp.io/en/abp/latest/UI/AspNetCore/Dynamic-JavaScript-Proxies
ajax: abp.libs.datatables.createAjax(cRK.nexus.riosoft.alvo.nxsAlteraStatusPed.alteraStatusPed.getList,
function() {
var filterstr =
"DescricaoStatus <> 'Faturado' and CodigoEmpresaFilial = " +
"'" + <<I want this to be the codigo property of the object returned by cRK.nexus.riosoft.alvo.GetFilialLogada()>> + "'";
if ($("#Filtro_FiltroStatus").val() !== "") {
filterstr += " AND DescricaoStatus like '$" + $("#Filtro_FiltroStatus").val() + "$'";
}
return {
filter: filterstr
//nome: $("#Filter_Pesquisa").val()
};
},
function(result) {
return {
recordsTotal: result.totalCount,
recordsFiltered: result.totalCount,
data: result.items
};
}),
columnDefs: [
{
title: l('Actions'),
rowAction: {
items:
[
{
text: l('Action:Edit'),
visible: true,
action: function (data) { }
},
{
text: l('Action:Delete'),
visible: true,
action: function (data) { }
}
]
}
},
{
title: l('Col:CodigoEmpresaFilial'),
data: "codigoEmpresaFilial"
},
{
title: l('Col:Numero'),
data: "numero"
},
{
title: l('Col:Tipo'),
data: "tipo"
},
{
title: l('Col:DataPedido'),
data: "dataPedido"
},
{
title: l('Col:DataEntrega'),
data: "dataEntrega"
},
{
title: l('Col:CodigoEntidade'),
data: "codigoEntidade"
},
{
title: l('Col:NomeFantasia'),
data: "nomeFantasia"
},
{
title: l('Col:ValorTotal'),
data: "valorTotal"
}
]
})
);
$("#Filtro_FiltroStatus").change(function () {
dataTable.ajax.reload();
});
</code>
<code>var dataTable = $('#AlteraStatusPedTable').DataTable(
abp.libs.datatables.normalizeConfiguration({
serverSide: true,
paging: true,
order: [[1, "desc"]],
searching: false,
scrollX: true,
//https://docs.abp.io/en/abp/latest/UI/AspNetCore/Dynamic-JavaScript-Proxies
ajax: abp.libs.datatables.createAjax(cRK.nexus.riosoft.alvo.nxsAlteraStatusPed.alteraStatusPed.getList,
function() {
var filterstr =
"DescricaoStatus <> 'Faturado' and CodigoEmpresaFilial = " +
"'" + <<I want this to be the codigo property of the object returned by cRK.nexus.riosoft.alvo.GetFilialLogada()>> + "'";
if ($("#Filtro_FiltroStatus").val() !== "") {
filterstr += " AND DescricaoStatus like '$" + $("#Filtro_FiltroStatus").val() + "$'";
}
return {
filter: filterstr
//nome: $("#Filter_Pesquisa").val()
};
},
function(result) {
return {
recordsTotal: result.totalCount,
recordsFiltered: result.totalCount,
data: result.items
};
}),
columnDefs: [
{
title: l('Actions'),
rowAction: {
items:
[
{
text: l('Action:Edit'),
visible: true,
action: function (data) { }
},
{
text: l('Action:Delete'),
visible: true,
action: function (data) { }
}
]
}
},
{
title: l('Col:CodigoEmpresaFilial'),
data: "codigoEmpresaFilial"
},
{
title: l('Col:Numero'),
data: "numero"
},
{
title: l('Col:Tipo'),
data: "tipo"
},
{
title: l('Col:DataPedido'),
data: "dataPedido"
},
{
title: l('Col:DataEntrega'),
data: "dataEntrega"
},
{
title: l('Col:CodigoEntidade'),
data: "codigoEntidade"
},
{
title: l('Col:NomeFantasia'),
data: "nomeFantasia"
},
{
title: l('Col:ValorTotal'),
data: "valorTotal"
}
]
})
);
$("#Filtro_FiltroStatus").change(function () {
dataTable.ajax.reload();
});
</code>
var dataTable = $('#AlteraStatusPedTable').DataTable(
abp.libs.datatables.normalizeConfiguration({
serverSide: true,
paging: true,
order: [[1, "desc"]],
searching: false,
scrollX: true,
//https://docs.abp.io/en/abp/latest/UI/AspNetCore/Dynamic-JavaScript-Proxies
ajax: abp.libs.datatables.createAjax(cRK.nexus.riosoft.alvo.nxsAlteraStatusPed.alteraStatusPed.getList,
function() {
var filterstr =
"DescricaoStatus <> 'Faturado' and CodigoEmpresaFilial = " +
"'" + <<I want this to be the codigo property of the object returned by cRK.nexus.riosoft.alvo.GetFilialLogada()>> + "'";
if ($("#Filtro_FiltroStatus").val() !== "") {
filterstr += " AND DescricaoStatus like '$" + $("#Filtro_FiltroStatus").val() + "$'";
}
return {
filter: filterstr
//nome: $("#Filter_Pesquisa").val()
};
},
function(result) {
return {
recordsTotal: result.totalCount,
recordsFiltered: result.totalCount,
data: result.items
};
}),
columnDefs: [
{
title: l('Actions'),
rowAction: {
items:
[
{
text: l('Action:Edit'),
visible: true,
action: function (data) { }
},
{
text: l('Action:Delete'),
visible: true,
action: function (data) { }
}
]
}
},
{
title: l('Col:CodigoEmpresaFilial'),
data: "codigoEmpresaFilial"
},
{
title: l('Col:Numero'),
data: "numero"
},
{
title: l('Col:Tipo'),
data: "tipo"
},
{
title: l('Col:DataPedido'),
data: "dataPedido"
},
{
title: l('Col:DataEntrega'),
data: "dataEntrega"
},
{
title: l('Col:CodigoEntidade'),
data: "codigoEntidade"
},
{
title: l('Col:NomeFantasia'),
data: "nomeFantasia"
},
{
title: l('Col:ValorTotal'),
data: "valorTotal"
}
]
})
);
$("#Filtro_FiltroStatus").change(function () {
dataTable.ajax.reload();
});
4