Knockout-Contrib / Knockout-Contrib/KoGrid

With multiSelect = false, clicking on a selected item does not unselect.

Open
#252 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
277
Forks
124
PR merge metrics
No merged PRs in 30d

Description

I am finding KoGrid to be very useful. I am also new to github. I can't seem to find where to put this so I figured here. The js I found for this KoGrid is not necessarily from this master as I found the one from the sample code to be more complete.

http://knockout-contrib.github.io/KoGrid/#/examples

Anyway, I made a fix to what I feel is a problem. With the mutliSelect set to false, once a single item is selected, you are unable to de-select it.

Code change:
// function to manage the selection action of a data item (entity)
self.ChangeSelection = function (rowItem, evt) {
grid.$$selectionPhase = true;
if (!self.multi) {
new --> if (self.lastClickedRow !== rowItem){
if (self.lastClickedRow && self.lastClickedRow.selected) {
self.setSelection(self.lastClickedRow, false);
}
new --> }
} else if (evt && evt.shiftKey) {

Now to figure out how to programmatically change the selection to be deselected as I want to use the items in the kogrid as a master list. I want to have the user select from the kogrid, push a button where my code will take the selected items and use them. When done, I want to be able to update the kogrid to de-select the kogrid items.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the ChangeSelection function in the KoGrid JavaScript and compare the master code with the sample code linked in the issue. Verify that clicking the selected row with multiSelect=false clears it, and determine how the grid's selection can be cleared after the caller uses the selected items.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.