问题描述
我使用下面的代码来捕获我在表上单击的索引,但它同时捕获了该表的所有索引,我不知道如何只捕获我单击的索引。我正在使用 Wix 代码。
让idSelecionado
let indiceSelecionado
导出异步函数 table1_click_1(event) {
let $item = $w.at(event.context)
idSelecionado = event.context.itemId
indiceSelecionado = await indiceDoItemnoDataset($w("#dataset1"),idSelecionado)
$w("#dataset1").setCurrentItemIndex(indiceSelecionado)
.then(async() => {
let item = await $w("#dataset1").getCurrentItem()
$w("#input16").value = item.nome
})
}
导出异步函数 indiceDoItemnoDataset($dataset,id) { let indiceIdentificado;
await $dataset.getItems(0,500)
.then(async (resultado) => {
await resultado.items.forEach(async (valor,indice) => {
if (valor._index === id) {
indiceIdentificado = await indice;
console.log(indiceIdentificado)
}
})
})
.catch((erro) => {
console.error(erro)
})
return await indiceIdentificado
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)