park
1
I want to know the index number of the item selected in the Selection
of ux in js.
I want to get the index of Selection
from js and create a function.
I can not know the index number currently selected in the SelectionChanged
event handler of the Selection
.
I used the event handler’s data.current._values[0]
in Fuse 0.36.0. But not in Fuse 1.0.0.
Is there any other way to use it?
Uldis
2
Hi park,
if you need an explicit index, you have to make sure your data context contains one. So either add it in your original data collection, like so:
var list = [
{index: 0, title: "some title"},
{index: 1, title: "some other title"},
{index: 2, title: "some other title 2"}
];
or if you use Observables, you can make an auto-indexing reactive map for the collection:
var list = Observable();
var indexed = list.map(function(item, index) {
return {index: index, item: item};
});
Hope this helps!
Would below code help?
function Select(arg){
clicked.value=arg.data;
}
var index = clicked.map(function(x){return Selection.indexOf(x)});