How to cancel typing japanese in cells wijmo flexgrid

Posted by: ngvanthuong97 on 16 October 2019, 5:27 am EST

    • Post Options:
    • Link

    Posted 16 October 2019, 5:27 am EST

    I want to setting a column in Flexgrid with format ZipCode ([0, 9], -).

    I use event “keydown”

    this._DemoGrid.hostElement.addEventListener('keydown', (e: KeyboardEvent) => {
          if (e.keyCode !== ...) {
            e.returnValue = false;
          }
        });
    

    But, I can’t cancel typing when I input Japanese characters. Because it save in clipboard and input after i get keyCode and set ‘e.returnValue = false;’

  • Posted 16 October 2019, 11:43 pm EST

    Hi,

    You wish to enter a value in a column using a specific format, I would suggest you use the mask property of the Column class. For example, in your case, you may use the ‘00000’ for zip code and ‘00000-0000’ for zip+4 code. Please refer to the code snippet and the sample below:

    var grid = new wjcGrid.FlexGrid('#grid', {
      autoGenerateColumns: false,
      itemsSource: getData(),
      columns: [
        { header: 'City', binding: 'city' },
        { header: 'Zip Code', binding: 'zipCode', mask: '00000' },
        { header: 'Zip+4 Code', binding: 'zip4Code', mask: '00000-0000'}
      ],
      allowAddNew: true 
    });
    

    https://stackblitz.com/edit/js-ln115w

    For further information on how to use a mask in columns, refer to the link below:

    https://www.grapecity.com/wijmo/api/classes/wijmo_input.inputmask.html

    Regards,

    Ashwin

Need extra support?

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

Learn More

Forum Channels