Code Monkey home page Code Monkey logo

Comments (7)

ghiscoding avatar ghiscoding commented on May 17, 2024

@jmzagorski
I found the issue in the Editor because of the use of the find and indexOf here to pre-select the default value. If we sort the collection descending, and we have a cell value of 94, the find will return 2 found items 9 and 4 and since the last found value is 4, it will select that one.

You can already see this bug on the live Example 3 demo on the "% complete" column because that one has the sorted collection in descending order.

from aurelia-slickgrid.

jmzagorski avatar jmzagorski commented on May 17, 2024

yup, can't remember why I used indexOf. I think because the multiSelect returned an array and I just copied a lot of the logic over to singelSelect without testing it good enough? I'll have to look at it

from aurelia-slickgrid.

ghiscoding avatar ghiscoding commented on May 17, 2024

I actually found that problem while doing the new feature of Excel Copy Buffer, which I just merged. This copy buffer uses the serializeValue function to copy each cell values into it's buffer when the column definition is an editable field (Example 3). So anyway, I believe the MultipleSelectEditor also has this problem since it also uses the indexOf.

from aurelia-slickgrid.

ghiscoding avatar ghiscoding commented on May 17, 2024

I tried it in my Angular repo and made these changes

-      if (this.defaultValue.indexOf($e.value) !== -1) {
+      if (this.defaultValue === $e.value) {

That seems to be all good, also note that this.defaultValue is of type string because the previous line adds a cast with toString().

You can do the change today or I'll make the change sometime tonight.

from aurelia-slickgrid.

jmzagorski avatar jmzagorski commented on May 17, 2024

That will work for the singleSelectEditor, but not the multipleSelectEditor. The multipleSelectEditor.defaultValue is an array so you need to make that indexOf check to see if the select value exists in the array. I believe this was a copy and paste error on my part from the multipleSelectEditor to the singleSelectEditor.

Side note, i was put on a high priority 1 week project since the end of last week so I have not been able to get to anything I wanted to on slickgrid.

from aurelia-slickgrid.

ghiscoding avatar ghiscoding commented on May 17, 2024

There was 2 indexOf in the MultipleSelectEditor and I changed one of them with the same modification as the SingleSelect. I think you were possibly thinking about the 1st indexOf, which I didn't change. Anyhow, I made the same change in both Editors and tested with Example 3 with the collection sorted descending and they both work as expected (I'm actually not sure if it affected the MultipleSelect at all, anyhow I changed it too).

We can re-open if it comes back, but it seems to be ok with the quick tests I made, so I'll close the issue.

from aurelia-slickgrid.

ghiscoding avatar ghiscoding commented on May 17, 2024

@jmzagorski
I just released last version 1.12.0 before vacations, this fix is included in it :)

A lot of goodies before I leave.

from aurelia-slickgrid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.