Content
block. While that block does allow for some dynamic ability via Lava processing, it's essentially a "one-shot" block. Whatever it renders is what you are stuck with, so to speak. Think of it like the HTML Content block. It's certainly dynamic in that you can use Lava to customize how it looks, but it doesn't allow the user to interact with it and change the content.Callbacks
. If you have an ASP.Net background, you can think of this as a partial postback. Otherwise, just know that this allows you to change the content displayed in the Content block in response to a user action, such as tapping on a button. To do this, it adds a new Command that is available for you to use: Callback
. This command allows you to send the command and parameters you define back to a special lava template defined in the Advanced Settings tab of the block.Callback
command and we have defined our custom Action object to have a sub-command of Search
. We also defined a parameter called Term
that will take it's value from the textbox.Search
button. This is what we are going to put into our Callback Event in the block's settings.Search
which is what we are expecting. If found, we then use the search lava command to search our serving teams and look for any groups that match the search term the user entered ({{ Parameters.Term }}
). For each result we get back, we render a button with the group name on it. If this was a full working example we would make that button do something, like go to a Rock page and pass the group Id.<Rock:Action />
for each button that performs another Callback
action and updates the UI based on the group they have selected.if
checks and other logic with Lava, so we decided to just use what you already know. If this makes you nervous, take an antacid pill because we're diving in!Event Handler
. This is Lava that will be executed when certain events happen on the page. You might be thinking, so what? I can only format data with Lava. Oh contraire. Well, normally you would be correct, but we have added a few custom bits to Lava in the mobile application. Let's start with a really simple example. First put a Content block on your page and set the content to be:PageValues.Message
. The PageValues
object exists on each page and is essentially a dictionary. You can store whatever values you want in it and access them. Because this object exists at the page level, it is shared between blocks.Text
value of the UsersValue
dictionary to the string it should have.ItemsLayout
and have specified that it should be a grid, which by default is vertical. The Span
parameter specifies how many columns there will be. Since we are binding that value to PageValues.Columns
we will need to set that in our Event Handler:Event
variable defined which will tell you the event that initiated the lava. Currently, there are two pre-defined events:Load
: This event is initiated when the page is loaded, but before any blocks have been instantiated.Resize
: This event is initiated when the available screen space has changed, such as a rotation.LavaEvent
command. The name of the event you wish to trigger is specified by the CommandParameter
. This means you can setup a button on screen that will trigger a custom Lava event and then you can update your PageValues any way you wish.