The demos are here
But it is hard to understand what the equivalent ES6 form is, so far I do this:
class Arena {}
const ArenaSelect = Select.ofType(Arena);
const items = [ { data: 1, text: '1' } ];
const arenaFilterItemSelected = (it) {
console.log(it); // not a value but a Proxy with Target, Handler and IsRevoked members
}
// ...
<ArenaSelect
items={items}
onItemSelect={arenaFilterItemSelected}
closeOnSelect
>
<Button rightIconName="caret-down" text={selected ? selected.label : '- select -'} />
</ArenaSelect>
Now, the onItemSelect gets a Proxy, how can I get the actual item value ?
At first glance this doesn't look like it should be working at all. A few things I've noticed:
Select.ofType() is only needed if you are using TypeScript (to take advantage of generic types). It's a no-op in plain JS; you can just use Select in place of ArenaSelect.arenaFilterItemSelected is supposed to be an arrow function? It's missing the => part.Select needs an itemRenderer prop so it knows how to render your items.closeOnSelect is not a valid prop; did you mean resetOnSelect?Assuming your example is in a working state, it sounds like the "Proxy" your onItemSelect is getting is a reference to the click event that triggered it (wrapped by React to be a proxy around the native browser event). But onItemSelect should receive two args: the item and the event.
@iongion a few things:
@blueprintjs/select or [email protected]) then you'll want to refer to the v2 docs as usage has changed significantly. _(labs <= 0.14 uses 1.0 APIs, but 0.15 uses 2.0. after 0.15, labs components were moved to select)_Thank you guys!
how do I declare itemRender can you show me the example?
Most helpful comment
@iongion a few things:
@blueprintjs/selector[email protected]) then you'll want to refer to the v2 docs as usage has changed significantly. _(labs <= 0.14 uses 1.0 APIs, but 0.15 uses 2.0. after 0.15, labs components were moved toselect)_