after jquery table.load() html element becomes undefined

前端 未结 1 1495
花落未央
花落未央 2020-12-22 06:56

I am rewriting the post to make it clearer

I have a HomeController that has the following Actions

public ActionResult About()
    {
        MapDetail         


        
相关标签:
1条回答
  • 2020-12-22 07:49

    So the problem was that i could not get the td element with the following code

    $("#MapDetails").children().children()[rowIndex]
    

    I have solved it in a very hacky way but would love to have a neater solution

    function setResultValue(colIndex, rowIndex, resultValue) {
    
    if ($("#MapDetails").children().children()[rowIndex] != undefined) {
        var cell = $("#MapDetails").children().children()[rowIndex].children[colIndex];
        cell.innerHTML = resultValue;
    }
    else {
        var newRow = 0, newCol = 0, assessmentLength = 5, elementPos = 0;
        newRow = rowIndex - 3;
        newCol = colIndex - 4;
    
        elementPos = (newRow * assessmentLength) + newCol;
        $(".test").get(elementPos).innerHTML = resultValue;
    
    }
    }
    

    .test is the class of my td as you could see in the markup

    My Question on the sequence of loading script element and dom element when partial view rendering is still there

    0 讨论(0)
提交回复
热议问题