knockout js data-bind属性不重定向正确的页面

时间:2014-06-24 16:10:03

标签: javascript jquery asp.net vb.net knockout.js

我正在维护由其他开发人员开发的应用程序。该应用程序使用asp.net和vb.net构建,并使用了knockout js。

我正在尝试更改代码中的一个链接。虽然我改变了它,但它会转到上一个链接。

现在的代码如下:

<a data-bind="    text: Title, attr: { 'href': 'jobs/details/default.aspx?v=' + Id }"></a>

我已将href属性更改为

<a data-bind="    text: Title, attr: { 'href': 'jobs/details/application/list.aspx?v=' + Id }"></a>

当我运行代码时,它仍然会转到default.aspx页面而不是application / list.aspx。当我检查元素(在浏览器中)时,我发现代码显示为

<a data-bind="    text: Title, attr: { 'href': 'jobs/details/application/list.aspx?v=' + Id }" href="jobs/details/default.aspx?v=2707">Process manager</a>

我无法找到来自 href = 部分的地方。

我在这里提供了页面中使用的淘汰赛js代码。

请建议我如何才能让它发挥作用

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();
    });


  });

请建议我

1 个答案:

答案 0 :(得分:0)

这感觉就像一个简单的缓存问题。尝试清除浏览器缓存并重新加载页面。