Bug: datatable.getSelectedId(true, true) returns mixed types

$$(id).getSelectedId(true, true) seems to returns IDs in mixed results:

[1605265779977, "1605265779974", "1605265779975", "1605265779976"]

I assume this is a bug?

Using webix 8.0.1

Tagged:

Comments

  • if original ids are of mixed type, then this is normal.
    https://snippet.webix.com/3oupwxa2

  • But I'm explicitly using the parameter "asString", documentation says: optional, specifies whether the returning result should be a string

  • @Christiaan
    you are right.
    but there is a note in docs details

    If the "asString" parameter is set, the result value will depend on the selection mode:
    
        "row" or true - 4 (as in the dataset)
        "column" - "votes"
        "cell" - "4_votes"
    
  • I don't fully understand that part of the documentation. But I think that applies to a single ID? Not an array

    It's weird that the array contains mixed values when they were not entered as mixed values...

  • This bug exists in other places too. I'm using a sidebar and onAfterSelect that has the id as parameter. The first time I select an item, the id is of type number as expected. Any click after that, the type is string.

    This causes problems when I compare it with an enum in Typescript, which is a number by default.

  • This causes problems when I compare it with an enum in Typescript, which is a number by default.

    try not to use strict equality ===
    use plain equality == instead

  • That is a workaround and would go against my linting rules. There are many workarounds for this bug but I'm reporting it as one so it will be solved in the future...

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!