#How to bind button to iterate on a list
1 messages · Page 1 of 1 (latest)
- In addition I would like to get the index of current element using it as parameter to a Query.
..
Hi there! Sorry for the delay in response, we really appreciate your patience.
To start with, can you give me a sample of the type of data in your list?
it's an array of jsons that I put inside the list (the regular one with images, and text)
The list elements handle the array fair & square in the List componnent, I just want to control the index that is shown
(My use case is to do some "tagging" for each element, via different buttons, and when the tag is occured, the list continue to the next element automatically
Alright. Thank you for the explanation.
You can manually get the index of the currently selected element by using the
following:
const index = List1.listData.findIndex((el) => {
return el.id === List1.selectedItem.id;
});
You can then proceed to, for example, get the element next to the currently
selected element like so:
index = index +1;
return List1.listData[index]
Does this answers your question?
Alright. Thank you for the explanation.
You can manually get the index of the currently selected element by using the
following:
const index = List1.listData.findIndex((el) => {
return el.id === List1.selectedItem.id;
});
You can then proceed to, for example, get the element next to the currently
selected element like so:
index = index +1;
return List1.listData[index]
Does this answers your question?
I want also to set it to the current List presentation
not only to get it
BTW I found that to get manually the elemnt I can use currentIndex
so basically, it's not answer my question 😦
got any ideas how to set the List item for another index?
Hi there!
Sorry for the late response. We really appreciate your patience.
I'm not sure I completely understand what you meant by "set the List item for
another index". Can you please elaborate so I can better help you?
To control about which item will be shown in the list (i.e. when user click a button anew item in the list will shown- the next one)
Did you understand what I meant? or should I provide some images?(it's pretty simple, maybe I'm not using the right words..)
I think that's a great idea! Please, show us what you intend 🙂
Here is list and a button (Before)
Herer is the situation after clicking the button "show element 3"
(Element number 3 is on focus)
There you go 🙂
I see! Can you tell me more about your use case and why you'd want to do this?
(My use case is to do some "tagging" for each element, via different buttons, and when the tag is occured, the list continue to the next element automatically )
The "show element 3" is just to demonstrate the effect that i want to make happen.
Would it be acceptable to instead filter the source data by these tags?
I if I understand, so yes, that also can help me. but I want that after tagging, the UI show the next element
How do you sugget to use filter?
I don't know why, but this always return the value of "0". Even If I move around in the list (select other item)
Hey! Sorry for the delay here. Could you elaborate what you mean in the last
message? What's returning a value of 0?
When I running this -> with my list : const index = List1.listData.findIndex((el) => { return el.id === List1.selectedItem.id; });
I do it without decleration const index...but rather directly return this index
I try to update my mongodb with the selected item. This is my overall update code: { "$set": { "array.{{List1.listData.findIndex((el)=>{ return el.id === List1.selectedItem.id })}}.accepted": "checked" } }
but {{List1.listData.findIndex((el)=>{ return el.id === List1.selectedItem.id })}} keep returning '0'
Would you be willing to get on a call to debug this?
Sure (but only on call, cause i can't show the app) in which platform?
Here on discord?
I can create a zoom link :) One moment
Okay 🙂
Zoom is the leader in modern enterprise video communications, with an easy, reliable cloud platform for video and audio conferencing, chat, and webinars across mobile, desktop, and room systems. Zoom Rooms is the original software-based conference room solution used around the world in board, conference, huddle, and training rooms, as well as ex...
(the last one is broken)
Sent to you in DM :)
We ended up rewriting the list to use the appsmith store so that it could be
manipulated after querying. We also discovered that the objects don't actually
have an id property, and that's why it was returning 0. After implementing these
changes and planning to add an id to the objects, the issue was resolved. Can
you confirm this @zinc coyote?
I Confirm! I appreciate the professional and the precise support! In addition to resolve that issue, I learnt more than few things about how to debug to console, and optimize my queries to the db. Thanks Jimmy!
Thanks for your continuous support and patience. We hope your issue is resolved
now.
Let us know how did we do?
https://survey.frontapp.com/v2/09a400bf433bc9676d67/f1edc3985e626d909244ab82a9050bd8
5 stars. but it seems that the survey not working 😦
"Failed send feedback" - several times...