SilkBuilder
  • SilkBuilder
  • Development Environment
    • Development Environment
    • System Elements
    • Project, Data Model and ORM
    • Development Formats
  • Silk Builder Training
    • Sample Database
    • Plain Application
    • Easy Application
    • Simple Application
    • Complex Application
    • Report Application
    • System Environment
  • Docs
    • The ORM Structure
    • SilkBuilder
    • Silk Service
    • Java Database Class
    • Report
  • Silk Tags
    • App
    • AppHeader
    • Button
    • ButtonItem
    • Chart
    • Column
    • Content
    • DataProvider
    • DataService
    • Form
    • Group
    • Header
    • HelpBox
    • If
    • Input
    • JQcode
    • JScode
    • LogicAction
    • LogicDimension
    • LogicGrid
    • Modal
    • ModalBody
    • ModalFooter
    • Module
    • Page
    • Pagination
    • Screen
    • ScreenFooter
    • ScreenHeader
    • Tab
    • TabItem
    • Table
    • TableBody
    • TableHeader
    • TabsNav
    • Tile
  • JavaScript Objects
    • Button
    • ChartJS
    • Column
    • DataProvider
    • EventManager
    • Form
    • Input
    • Modal
    • Pagination
    • SilkPage
    • Table
    • TabsNav
    • Tile
    • Utility Functions
  • Coding Techniques
    • Data Trees
    • Pagination
    • Mark Deleted
    • Record Sync
    • Filtering Code
    • Content Template
    • Sort Data Columns
    • Form Input File
    • Button with Confirmation
    • Toggle List
    • Table Inputs
Powered by GitBook
On this page
  • The Logic
  • The Logic Statement
  1. Coding Techniques

Filtering Code

There are cases in which, under certain conditions, some blocks of code or components should not be rendered and delivered to the client. The most common scenario is when particular application options should not displayed due to user role restrictions.

Some Silk Tags can be configured to include logic determining whether or not these will render the HTML and Javascript code at server time before delivering it to the user's navigator. The property used for this purpose is renderIf and should contain the filtering logic statement. The tags with this property are:

  • silk:If

  • silk:Button

  • silk:App

  • silk:Input

  • silk:Table

  • silk:Column

  • silk:Form - Also uses buttonTest to define what form's buttons to be rendered.

  • silk:Input

  • silk:Modal

  • silk:Chart

The Logic

The basic logic could be a Java Boolean object with a "true" or "false" value;

<%
	Boolean display = true; // Developer applies logic to arrive to this value.
%>

This could also work if the Java String object containg the "true" of "flase" string values.

<%
	String display = "true"; // Developer applies logic to arrive to this value.
%> 

This Java String object can be used directly in the renderIf property.

<silk:If renderIf="<%= display %>" >
    HTML, components, or code.
</silk:If>

<silk:Button id="buttonEdit" label="Edit" renderIf="<%= display %>" />

The most common use for this code filtering logic is using Spring view variables.

<silk:If renderIf="12 = ${ageLimit}" >
    HTML, components, or code.
</silk:If>

The Logic Statement

These are the logic options. The lists are comma separated values.

Logic
Description

true or false

Direct logic value

value = ${variable}

Value equal to variable

value != ${variable}

Value is different than variable

value in ${variable-list}

Value exists in the variable-list

value not-in ${variable-list}

Value does not exists in the variable-list

value-list one-in ${variable-list}

At least one of the items in value-list exists in the variable-list

value-list all-in ${variable-list}

All the items in the value-list have to exist in the variable-list

PreviousRecord SyncNextContent Template

Last updated 1 year ago