Card Class Reference
Overview
This is a new class to add card items in a screen with a multi column layout. It is used for home and intermediate navigation screen, where the amount of items is limited. All methods in this class are static.
The default number of cards per row is 2. This can be changed dynamically by calling Card.setColumns() method, allowing complex layout on the same screen.
First make a call to Card.init(), then multiple calls to Card.add() followed by a final call to Card.show().
Card Sample App on GithubCard.init()
This must be the first call to initialize the Card class before any other methods are called.
Card.addTitle(title, subtitle)
Adds a centered title and subtitle to the screen.
Card.addTitle("Contacts", "34,456 records");
Card.addHeader(label)
Adds a new section header named label. label is an optional string and may be null.
Card.addHeader("Manager Dashboard");
Card.setColumns(count)
Defines the number of card per row. It forces a section break. count can be 1,2, 3 or 4. During Card.init(), the default card count per row is set to 2. Call this method only if you want ot mix different number of cards per row in the same screen.>/p>
Card.setColumns(3)
Card.add(label, onclick, style)
Adds a new card on the screen. A card has a white background and a label. You can define an optional colored icon image and/or a counter value in the style parameter. The onclick param is an optional callback function.
Format of the style string is "img:[icon];count:[a-Z];color:[aColor].
Valid color values are blue, green, orange, red, teal, brown, purple, yellow or any HTML hexa color code string.
Card.add("Support", "showSupport()", "img:support"); Card.add("Contacts", "showContactList()", "img:contact;count:543;color:blue"); Card.add("Companies", "showCompanyList()", "img:company;color:orange");
Card.addButton(label, onclick, style)
Adds a new button on the screen. A button has a background color, an optional label and/or an icon image;
- Icon is specified in the img attribute in the style parameter;
- Background color are specified in color attribute in the style parameter.
Card.addButton("Lookup", "lookup()", "color:blue;img:search");
Card.show()
This must be the last call to render the screen.
Card.init(); Card.add("Hello"); Card.add("World"); Card.show();