我在knockout.js.But成功消费api根据我的表定义(id,名称,借方,贷方,金额),这是基于会计。我想显示的金额,如果它是信用卡或借记卡并非所有的金额都在借记和贷记的同时。帮助我分别在redit和debit下显示金额。 这是viewmodel
setlocale(LC_MONETARY, 'fr_FR');
setlocale(LC_MONETARY, 'fr_FR.UTF-8');
setlocale(LC_MONETARY, 'en_US.UTF-8');
setlocale(LC_NUMERIC, 'en_US');
这是我的观点
function JournalViewModel() {
var self = this;
self.Period = ko.observable();
self.PayGroup = ko.observable();
self.PayGroups = ko.observableArray([]);
self.LoadPeriods = function () {
$.ajax({
url: baseUrl + 'api/Process/Load',
type: 'GET',
headers: { 'Access-Control-Allow-Origin': '*' },
dataType: 'json',
success: function (data) {
console.log(data);
if (data.Successfull == 1) {
self.Period(data.Model.CurrentPeriod);
self.PayGroups(data.Model.Paygroups);
}
},
error: function (request, error) {
console.log(error);
}
});
}
self.periodId = ko.observable();
self.PaygroupId = ko.observable();
self.Journal = ko.observableArray([]);
self.PayMaster = ko.observableArray();
self.LoadJournal = function () {
$.ajax({
url: baseUrl + 'api/Journal/LoadJournal/'+periodId +'/'+self.PaygroupId(),
type: 'GET',
cache: false,
headers: { 'Access-Control-Allow-Origin': '*' },
dataType: 'json',
success: function (data) {
if (data.HasError == 0) {
self.Journal(data.Model);
console.log(data.Model);
alert("Journal Successfully Processed");
$("#listTable").DataTable();
}
},
error: function (request, error) {
console.log(error);
}
});
}
self.StartDate = ko.observable()
self.EndDate = ko.observable()
self.NbDays = ko.observable();
self.NbHours = ko.observable();
self.Code = ko.observable();
self.CountEmployees = ko.observable();
self.LoadPeriods();
}ko.applyBindings(new JournalViewModel());
答案 0 :(得分:1)
问题是你在标签上有if条件,如果为false则不会呈现。诀窍是将它放在标签内,因为你希望它一直显示,而不是内部的值。 (如果我正确理解你的问题)
context.Response.Headers.Add("X-Access-Token", newToken);
context.Response.Headers.Add("Access-Control-Expose-Headers", "X-Access-Token");