169
Views
4
Comments
How to call the block using button

i have been created an app.it has one screen inside that i have created an add task button.and also created an external block.if i click the button the block need to shown in the main content of the screen.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Arjun S ,

if the block represents a single task, and you want to add a new task (and so a new block to your screen) possibly more than once, you can 

  • create a variable as list of tasks
  • add a list widget to your screen
  • put the block in the list widget
  • just append to your list when button gets clicked
  • dependent on what you are actually doing on the screen (i.e. when and how these tasks get persisted and retrieved, is it done by the screen or the block, ...) you will have things like inputs into your block and events out of your block to keep track of things

Dorine

UserImage.jpg
Puja Rani

Hi,

If I understood correctly, then you can  - 

Drag your web block to the main screen. Enclose it inside a container. Create a Boolean Variable like IsShow (set default False) and bind it to container visibility parameter. On click of button, make this local var value to True. In this case your web block will be visible only when you click on that button. In case the requirement is different, please elaborate.

2018-06-05 16-54-03
Maria da Graça Peixoto

Hi! 

What do you mean by "external block" ? 

If it is a normal Webblock , one way is :

Create a boolean local variable - let's call it Mytest  ;

Put an "If" widget in the place where your block must be shown with the condition "Mytest" ;

Drag the block to the true side  of the "if";

Have the action from the button put the Mytest to true. 

I believe some thing like that would  do what you need, 

Regards

Graça


UserImage.jpg
vikas sharma
Champion

Hi,

Agree with @Dorine Boudry answer. You just need to maintain a list. When user click on Add button just append one item in the list. In list item there is block already. So now list size increase this block will visible on the screen.

In below screenshot, UserInfo block is your block which you want to add on button click. So basically this block is already there in list item. When user click on the button, you just need to append one item in the list and this block visible on the screen as list item.


regards 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.