about custom editors for spreadsheet

edited May 14 in Technical questions

1.there are only four editors(the editor type :richselect, popup, date, text),so can I custom button/checkbox as a editor? rather than this solution (embedded directly via cell values) https://forum.webix.com/discussion/35945/adding-checkbox-in-spreadsheet-cell#latest

2.If I set a cell as a custom/int/percent format,I hope to limit user to input any char except 0-9 and decimal separator.
Also, I need to limit user to do this:
if decimal is 2. User can't keyin 2.35454
and control user input the specified length of the text.

can we do that? thanks a lot.

Tagged:

Comments

  • edited May 15

    Hi @zzhang

    1) Unfortunately, the only available method is adding via setCellValue.

    Check this snippet with extra logic to maintain checkbox interactivity: https://snippet.webix.com/vp05oh6c

    2) Please check this snippet: https://snippet.webix.com/nkjq8wjd

  • hi Dima_S,
    Thank you for your answer.

    1) couldn't we create fully custom editors like this:
    webix.editors = {
    "mytext":{
    focus:function(){/.../},
    getValue:function(){/.../},
    setValue:function(value){/.../},
    render:function(){/.../}
    }
    };
    I saw it in https://docs.webix.com/desktop__editing.html#customeditors

    2) about this issue,I am sorry I didn't make myself clear.
    2.1) If this cell is int or percent format, I hope user cannot input any char(a-z) but only 0-9 and .(Decimal character);

    2.2) if this cell is formatted to show 2 digits,then i hope to limit user to input third digit rather than show 2 digits after editing by toFixed(2).

    2.3)If this cell is text format,need to show the text by specified max length.

    can you do that? thank you so much!

  • edited May 16

    1) In order to do so, you need to change the column template. There is no easy way to do this, so the recommended way is adding via setCellValue.

    2.1) Take into account, you cannot enter formulas in this case.
    Example: https://snippet.webix.com/xi8r5yjx
    2.2) Try this: +Number(value).toFixed(limit).
    Example: https://snippet.webix.com/v4cu8m37
    2.3) Could you please clarify what do you mean by "text format"?

  • hi Dima_S, thanks a lot,it works.
    2.3) text format means no format.
    this problem can be solved according to 2.1,
    https://snippet.webix.com/siai8vfo

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion