Premium support for our pure JavaScript UI components


Post by pmiklashevich »

Hi! There are few issues with the types. All of them are small, so I combined them in one post.

_1. https://bryntum.com/docs/scheduler-pro/api/Core/data/field/IntegerDataField
Real type is "integer". "int" is an alias. Worth to mention this in docs.

_2. Filters do not work right for integer fields.

Testcase:

// Model class
class GroupModel extends Model {
  static get $name(): string {
    return 'GroupModel'
  }

  static get fields(): Partial<DataFieldConfig>[] {
    return [
      { name: 'teamId', type: 'int', dataSource: 'team_id' },
      { name: 'numPlayers', type: 'number', readOnly: true, persist: false },
    ]
  }
}
// Grid columns
const columns: Partial<ColumnConfig>[] = [
  {
    text: 'Groups',
    field: 'title',
    flex: 1,
  },
  {
    text: 'Team ID',
    field: 'teamId',
    width: 100,
    align: 'right',
  },
  {
    text: '#',
    field: 'numPlayers',
    width: 20,
    align: 'right',
  },
]

See result:

  • rendered good

    Screen Shot 2022-08-08 at 02.05.23.png
    Screen Shot 2022-08-08 at 02.05.23.png (68.09 KiB) Viewed 386 times
  • Team ID header filter - OK

    Screen Shot 2022-08-08 at 02.05.32.png
    Screen Shot 2022-08-08 at 02.05.32.png (66.94 KiB) Viewed 386 times
  • Team ID cell menu - NOT OK:
    a. You can only apply "Equal" filter
    b. Once you apply equal from cell menu, there is no value in header filter

    Screen Shot 2022-08-08 at 02.05.41.png
    Screen Shot 2022-08-08 at 02.05.41.png (70.38 KiB) Viewed 386 times
  • _# header filter is OK

    Screen Shot 2022-08-08 at 02.06.10.png
    Screen Shot 2022-08-08 at 02.06.10.png (64.79 KiB) Viewed 386 times
  • _# cell menu - OK: it has < > = filters and the value matches the header filter

    Screen Shot 2022-08-08 at 02.06.42.png
    Screen Shot 2022-08-08 at 02.06.42.png (70.22 KiB) Viewed 386 times

_3. The issue with filter can be worked around with filterType column config. For example:

const columns: Partial<ColumnConfig>[] = [
  ....
  {
    text: 'Team ID',
    field: 'teamId',
    width: 100,
    align: 'right',
    filterType: 'number', // This is the fix for int data field
  },
  ...
]

Team ID cell filter works

Screen Shot 2022-08-08 at 02.15.59.png
Screen Shot 2022-08-08 at 02.15.59.png (66.91 KiB) Viewed 386 times

_4. Please improve filterType by providing possible values instead of String type. It is not obvious what values are supported.

Thanks

Pavlo Miklashevych
Sr. Frontend Developer


Post by alex.l »

Hi Pavel,
Try to specify type for column, it will set up correct filters, editors and formatting.
https://bryntum.com/docs/grid/guide/Grid/basics/columns#column-types

For the rest, I've opened a ticket here https://github.com/bryntum/support/issues/5022
Thank you!

All the best,
Alex


Post by pmiklashevich »

Hi Alex,

Thanks for creating a new ticket for the typings issue.

Try to specify type for column, it will set up correct filters, editors and formatting.

That might fix the issue, right. But nevertheless my testcase is valid.

  1. "type" config is not public on Column class. There is only property. So I get another typings issue.

    Object literal may only specify known properties, and 'type' does not exist in type 'Partial<ColumnConfig>'.
    Screen Shot 2022-08-08 at 15.38.17.png
    Screen Shot 2022-08-08 at 15.38.17.png (157 KiB) Viewed 366 times
  2. "type" is not a required config. It can be omitted. Therefore please add to the testcase a note to do not specify type explicitly for the column. In this case the type of the filter component is based on the data field type.

Cheers!

Pavlo Miklashevych
Sr. Frontend Developer


Post by alex.l »

I've opened a ticket for type problem https://github.com/bryntum/support/issues/5031
We discussed #2 and you're right, it should recognise type of the model data field. Please use my suggestion as a workaround meanwhile
Another ticket is here https://github.com/bryntum/support/issues/5032

All the best,
Alex


Post by pmiklashevich »

Hi! What's the status of 5031? Should be an easy doc fix, right?

Pavlo Miklashevych
Sr. Frontend Developer


Post by mats »

Yes, we'll get that one fixed asap. Thanks for the reminder :)


Post Reply