Client-side SetLocked() method not working...

Posted by: rh0314 on 8 September 2017, 2:12 pm EST

  • Posted 8 September 2017, 2:12 pm EST

    following the example in the objectmodel.aspx page in the NewFeaturesDemo solution, I am trying to set the locked property of a cell to true using client side-script.  However, whenever I try to run it, i receive an error, "Object doesn't support this property or method."


     Here's the javascript code:


     


    function DisableCell(Row, Col) {


    var spread = document.getElementById("ctl00_BodyContent_FpSpread1");


    if (spread != null) {


    var cell = spread.Cells(Row, Col);


    if (cell) {


    if (cell.GetBackColor() != "red") cell.SetBackColor("red");


    if (!cell.GetLocked()) cell.SetLocked(false);


    }


    }


    }


     


    The portion highlighted in yellow is the part that produces the error.  What am I doing wrong here??  It seems like I'm following the example exactly.

  • Replied 8 September 2017, 2:12 pm EST

    Hi, to set a cell Locked (or unlocked), you should use the following code at client side:

    cell.setAttribute("FpCellType", "readonly");

    cell.removeAttribute("FpCellType");

    Please note that spread.Cells(Row, Col) returns TD element in HTML.

    Thanks,

    ~Jacob 

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels