export function box101_onClick(event, $w) {
$w("#dataset1").setCurrentItemIndex(0);
}
//same code box102~box109
export function box110_onClick(event, $w) {
$w("#dataset1").setCurrentItemIndex(9);
}
//add new code and new dataset(new Item)
export function box111_onClick(event, $w) {
$w("#dataset1").setCurrentItemIndex(10);
}
When I add a new item (data) to the database, it is added to ItemIndex"0".
Because of that, the reference value of data I already coded shifts one by one.
I wanted add a new item (data) to the ItemIndex “10”
How can I solve it?
Can you please describe the reason why you want to add a record to a specific index? It might be easier so help you if I knew the reason you want to do it this way.
Hi,
I’m not sure that I fully understand what’s the scenario. Why it is important to you to insert an item to a specific index? You can simply query the collection and find it, without using a specific index. Note that, as you mentioned, the index can be changed. Therefore, I don’t recommend find an element based on the index. You can use the query functoin indead. You can also use hooks before / after instering an item to a collection (if needed).