When I assign ID number 1 to the first button in each group, they all end up with the same ID, causing conflicts. How can I solve this issue?

Here’s the English translation of your text:


Issue with ID number 1 from every dynamically created button.

I’m using a loop block, where I’m generating dynamic buttons.
I have 8 main dynamic buttons. Each of these main buttons contains another set of dynamic buttons (for example, 4 buttons representing sections). When any of these section buttons is clicked, it displays a final group of buttons. Clicking any button in this last group shows the actual content.

For example:
The first main dynamic button is named “Library.” Inside it, there are 4 dynamic section buttons. When a user clicks on any of these sections, a final group of buttons appears. Clicking a button in this final group displays the content.

The problem I’m facing is ID collision:
When I assign ID number 1 to the first button in each group, they all end up with the same ID, causing conflicts.

How can I solve this issue?

Thank you in advance!

1 Like

Hi dear,

Recently I helped another user solve a similar issue, which resulted in this guide.

I’d suggest ignoring the function and looking at how the project works, because it contains logic similar to what you’re asking for to display the data.

Go straight to creating a dictionary with keys matching the values you assigned to the first 8 buttons, and for each key use another dictionary whose keys are the section names and whose values are the final content

it’s a bit cumbersome but it uses RecyclerList, which I consider essential for a modern and smooth app


Each dynamic button must have a unique numberID, so the first layer of categories will be 4 buttons with indexes 1, 2, 3, 4. Then, when you click a category, you’ll delete all the buttons with a for loop and generate the buttons for the sections in that category and so on.

( How is that possible with the dynamic buttons that belong to kodular

And this block that I attached as an image—where should I place it?

Hi dear,
I don’t think I understood very well, could you explain yourself better?

I mean, I use dynamic buttons, not an extension. does it work, so how does it work !!


NestedCategories.aia (5.0 KB)

Here is the translated project with the DynamicButtons (all this logic is a bit overkill with only one subcategory but alright).

If you have any doubts about how it works, feel free to ask.

1 Like

I have a question … How to make the main button according to your project that you sent … That text appears different from the main second or third button and so on

Sorry, I don’t think I understood, could you explain it better?

1 Like

“How can I distinguish the main or sub button from the other buttons based on its functionality? For example, the main button deletes itself after being pressed and adds text, and so on.”

You could do something like this,
when generating the buttons, check the length of the keypath (which tells you how deep you are in the dictionary) and based on that, write what “functionality” it represents.

1 Like

Thank you your learning succeeded .. But I forgot to ask you a question .. I’ll give an example . An example. . If I have a main button named library and in the main button it has 3 sections . He clicked on one of the sections and the content appeared . I want to return to other sections how the return process is done !! Both were in the departments !!

Hi dear,
it’s already implemented,


it simply removes the last element from the keypath and regenerates the buttons.

1 Like

Thank you. I didn’t pay attention to her .she was there..I have a question How to determine the mechanism of action of a particular button by its name only and the ID how so

:grin:

Forgive me, I didn’t understand very well.
Do you want to perform a specific action when a certain button is clicked?

Yeah .. Identify the button by the name of the button ! How so

In ButtonClick a GetText is already executed, which returns the text of the button, so you could run a condition if it matches something.
For example,


if GetText(id) = "Category3"
   do something.
1 Like

Core Fix (concept you must apply):

Every dynamic button must have a unique ID, not just “1”, “1”, “1”.

How to do that (example pattern, not your final answer):

Instead of giving every group the same ID like 1, give them IDs that combine the group + the position, something like:

  • mainIndex + "_" + sectionIndex + "_" + buttonIndex

This way every button becomes automatically unique.

Your turn (one small step):

If your first main button is 1, first section is 1, and first sub-button is 1…
What would that ID look like using the pattern above?

In the file that you attached to me earlier . I made a one-button operation C1 how to make this C1 perform its own operation regardless of the main commands

And only when we click the button labeled Category2, the notification is shown.