question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why is `selectCheck` bound?

See original GitHub issue

I’m submitting a … (check one with “x”)

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior

Because selectCheck is bound to the selection.component it’s pretty difficult to use.

Expected behavior

selectCheck is a documented as a pure function that takes three arguments. There’s no reason (obvious to me) that it should be bound (.bind(this)) to anything but the component where I implement it.

What is the motivation / use case for changing the behavior?

for selectCheck to be useful, we need access to fields in the class implementing the table.

// in our class which implements the table:
  selectCheck(row) {
   // compare to what? I cannot reference a field on my class here,
   // because `this` maps to the `DataTableSelectionComponent` instance,
   // which our code knows nothing about. 
  }

There are workarounds, obviously, but since selectCheck seems to be documented as a pure function, and is passed to array.filter anyway, what is the use-case for it being bound to DataTableSelectionComponent

Please tell us about your environment:

Windows, VSCode, npm, webpack + webpackDevServer

  • Table version: 9.0.0

  • Angular version: 4.0.2

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] all

  • Language: [all | TypeScript X.X | ES6/7 | ES5] all

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:9
  • Comments:5

github_iconTop GitHub Comments

3reactions
hernanBeizacommented, Aug 5, 2020

Still exist in ^16.1.1. For future devs:

If you need access to your component where you implemented this table, declare your function like this:

public validateSelect = (item: MyTypeOrAny) => { 
    //here you can get access to your functions and vars declared in your component as usual
}

But this way you cannot call to the component functions or vars

  public validateSelect(item:MyTypeOrAny):boolean { 
    //missed context here
}

Extracted from https://github.com/swimlane/ngx-datatable/issues/560

0reactions
kja-xytcommented, Nov 16, 2018

Is there any workaround available? I’d like to reference field from my class.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot select Check box using python selenium binding. #812
All, I am facing a weird issue when i try to select the check box. It is a check box to remember the...
Read more >
DataGrid bound to OData - How to enable/disable select ...
I have a DevExtreme dxdatagrid in my SPA with checkboxes to select and is bound to an OData query. i.e. data is loaded...
Read more >
Bind listeners for message-driven beans settings - IBM
In the list of mappings, select the Select check box for each EJB module that you want mapped to a particular binding.
Read more >
AngularJS : Select doesn't change selected option on change ...
On app init I want to select a specific option by changing bound variable on the scope. ... and it uses "===" to...
Read more >
Thunderbolt devices may not work properly if swapped during ...
To resolve these issues, disconnect all devices attached to the Thunderbolt ports, wait 5 seconds, and then reattach the ... Then select Check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found