Formula is shown in the cell when the user edit

Posted by: jonathanlau2828 on 8 August 2019, 8:17 pm EST

  • Posted 8 August 2019, 8:17 pm EST

    Hi,

    We are using the Spread Web form control in our project. There is a scenario we should override the formula cell. When we place the cursor in the cell, it is showing the formula to the user and user have to delete the formula manually.

    Is there way to hide the formula when the user selects that cell. We found this is achievable in Spread Winforms control. Attached a video on our requirement. Please do the needful.

    localhost_65265_Matrix_WebForm1 - Google Chrome 05-07-2019 14_46_48.zip

  • Posted 11 August 2019, 5:56 pm EST

    Hi Jonathan,

    For this, you need to handle the EditStart event and select complete text for InputElement if the text is formula.

    Please refer to the following demo sample for reference:

    <script>
            FpSpread1.addEventListener("EditStart", function (e) {
                setTimeout(function () {
                    var defaulClassName = "DefaultInput DefaultTextEditor";
                    var input = e.cell.querySelector("input");
                    // check if the cell contains formula with default editor
                    if (input.className == defaulClassName && input.value.indexOf("=") > -1) {
                        input.focus();
                        input.select();
                    }
                });
            }, true)
        </script>
    

    Regards,

    Manish Gupta

    SelectFormulaText.zip

Need extra support?

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

Learn More

Forum Channels