[英]knockout js data-bind attribute not redirecting the correct page
I am maintaining a application developed by another developer. 我正在维护另一个开发人员开发的应用程序。 The application built with asp.net and vb.net and it used knockout js.
该应用程序使用asp.net和vb.net构建,并使用了剔除js。
I am trying to change one link in the code. 我正在尝试更改代码中的一个链接。 Though I change the line it goes to the previous link.
尽管我更改了该行,但它转到了上一个链接。
The present code is like following 现在的代码如下
<a data-bind=" text: Title, attr: { 'href': 'jobs/details/default.aspx?v=' + Id }"></a>
I have changed the href attribute into 我已经将href属性更改为
<a data-bind=" text: Title, attr: { 'href': 'jobs/details/application/list.aspx?v=' + Id }"></a>
When I run the code it still goes to the default.aspx page instead of application/list.aspx. 当我运行代码时,它仍然转到default.aspx页面,而不是application / list.aspx。 When I inspected the element (in the browser) I found the code is showing like
当我检查元素(在浏览器中)时,我发现代码显示为
<a data-bind=" text: Title, attr: { 'href': 'jobs/details/application/list.aspx?v=' + Id }" href="jobs/details/default.aspx?v=2707">Process manager</a>
I was not able to find from where href= part coming from. 我找不到来自哪里的href =零件。
I am providing the knockout js code used in the page here. 我在这里提供在页面中使用的剔除js代码。
Please suggest how can I make it work 请提出如何使它起作用
The Knockout JS code is like following Knockout JS代码如下
var dbVm = {};
dbVm.jobs = ko.observableArray([]);
dbVm.applications = ko.observableArray([]);
dbVm.candidates = ko.observableArray([]);
dbVm.openJobs = ko.observableArray([]);
dbVm.newApplications = ko.observableArray([]);
dbVm.newTasks = ko.observableArray([]);
ko.applyBindings(dbVm);
$(function () {
dimNav('dashboard');
$('.tip').width($('.db-wrapper').width());
$('.rvqv').click(function () {
var cList = $(this).attr('data-cont');
$('.db-rv-wrapper div.d-tabs').hide();
$(cList).show();
$('.rvqv').removeClass('active');
$(this).addClass('active');
});
$('.rvqv:first').trigger('click');
//
//Trigger tips
//
$.when(
$.ajax({
type: "POST",
url: "/_services/UtilityService.asmx/CurrentStatus",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json"
})).done(function (r1) {
var r = r1.d, totalOj = 0, totalLj = 0,
totalNa = 0, totalAra = 0,
totalTd = 0, totalInt = 0;
totalOj = parseInt(r.TotalOj);
totalLj = parseInt(r.TotalLj);
totalNa = parseInt(r.TotalNewApp);
totalAra = parseInt(r.TotalAra);
totalTd = parseInt(r.TotalT);
totalInt = parseInt(r.TotalI);
$('.e-db-cs #oj h3').html(totalOj);
$('.e-db-cs #oj #lj').html(totalLj > 0?totalLj:'none');
$('.e-db-cs #na h3').html(totalAra);
$('.e-db-cs #na #ara').html(totalNa > 0 ? totalNa : 'none');
$('.e-db-cs #td h3').html(totalTd);
$('.e-db-cs #td #int').html(totalInt > 0? totalInt : 'no');
if (totalOj > 0 || totalLj > 0) {
$('#oj > a').removeClass('disabled');
Tipped.create('#oj', $('#ojDetails')[0], {
hook: 'bottomleft',
containment: false,
showDelay: 400,
hideDelay: 300,
onShow: function (content, element) {
$('#oj > a').addClass('active');
},
onHide: function (content, element) {
$('#oj > a').removeClass('active');
}
});
} else {
$('#oj > a').addClass('disabled');
}
if (totalNa > 0 || totalAra > 0) {
$('#na > a').removeClass('disabled');
Tipped.create('#na', $('#naDetails')[0], {
hook: 'bottommiddle',
containment: false,
showDelay: 400,
hideDelay: 300,
onShow: function (content, element) {
$('#na > a').addClass('active');
},
onHide: function (content, element) {
$('#na > a').removeClass('active');
}
});
} else {
$('#na > a').addClass('disabled');
}
if (totalTd > 0 || totalInt > 0) {
$('#td > a').removeClass('disabled');
Tipped.create('#td', $('#tdDetails')[0], {
hook: 'bottomright',
containment: false,
showDelay: 400,
hideDelay: 300,
onShow: function (content, element) {
$('#td > a').addClass('active');
},
onHide: function (content, element) {
$('#td > a').removeClass('active');
}
});
} else {
$('#td > a').addClass('disabled');
}
});
//
//Tooltip datas
//
$.when(
$.ajax({
type: "POST",
url: "/_services/UtilityService.asmx/OpenVacancyList",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json"
}), $.ajax({
type: "POST",
url: "/_services/UtilityService.asmx/OpenApplications",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json"
}), $.ajax({
type: "POST",
url: "/_services/UtilityService.asmx/UpcomingTasks",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json"
})).done(function (r1, r2, r3) {
dbVm.openJobs(r1[0].d);
dbVm.newApplications(r2[0].d);
dbVm.newTasks($.parseJSON(r3[0].d));
momentize();
});
//
// Recent items data
//
$.when(
$.ajax({
type: "POST",
url: "/_services/UtilityService.asmx/RecentlyViewedJobs",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json"
}),
$.ajax({
type: "POST",
url: "/_services/UtilityService.asmx/RecentlyViewedApplications",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json"
}),
$.ajax({
type: "POST",
url: "/_services/UtilityService.asmx/RecentlyViewedCandidates",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json"
})).done(function (r1, r2, r3) {
dbVm.jobs(r1[0].d);
dbVm.applications(r2[0].d);
dbVm.candidates(r3[0].d);
momentize();
});
});
Please suggest me 请建议我
This feels like a simple caching issue. 这感觉就像一个简单的缓存问题。 Try clearing your browser cache and reloading the page.
尝试清除浏览器缓存并重新加载页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.