Section

Posted: 2017-01-24 in Section

Q:
Is it possible to have a collapsible section start off collapsed?
I have several sections on a page and a few of them would only be occasionally used. So, it would be nice to have the page start with them collapsed so the other sections can be more visible.
A:
In the “Ready” delegate for the page you can collapse the sections.

Code:
Lianja.get("customers.section2").collapse()

Added a new section attribute “Apply rules on parent data change“. This causes the UI presentation rules to be evaluated dynamically as you navigate data in the parent section.
You can therefore
hide/show other related sections based on the data that is being displayed in the parent section.
Note that when the UI presentation rules are applied the “Visible When” and “Readonly When” conditions are evaluated. This is only
effective in runtime mode.


Visible when” and “Readonly when” are evaluated when you

Code:
Lianja.get("page.section").applyRules()

This happens automatically if you have set the section attribute “Apply rules on change” in the “UI Presentation Rules”.
This will then cause the UI to hide and show elements dynamically depending on the data being currently viewed.


Q:
It is possible to display a grid within a canvas section?
I don’t want the grid in a separate section, I want it included with the section being used to potentially display basic or related information.
Here’s what I’m thinking:
– Add a label
– Add a combobox
– Display values in a grid based on the selected combobox value. Data would possibly come a a virtual table.
Using Southwind as an example (albeit not the best example):
label: Expenses
combobox values: Monthly Expenses (as label) and values (choices) could be individual months
grid: display the orders for the selected month
A:
A page can be arranged out of numerous sections that can have the section header hidden at runtime. So the page acts and appears as one section although it has been visually designed out of many.
Sections can be grouped together (there is an example demo App showing how to achieve this) so they expand and collapse as one section.

There are various examples of this. The Custom Canvas Demo example App uses a TreeGrid.


SQL with {…} macros is used to relate the sections.


In v1.2.2 there is a new section attribute “Where condition” that can be used to requery() Virtual Tables dynamically. This is a SQL SELECT WHERE condition for your target SQL database.
It can be set dynamically:

Code:
Lianja.get("page1.section1").where = "account > 1000 and empid = '0001'"

or

Code:
Lianja.showDocument("page: page1.section1?action=where&text=account gt 1000 and empid eq '0001'"

(notice how I have specified the where condition above in OData format).
So If you are working with large amounts of data create your VT as SELECT… WHERE 1=0
Then change the “where condition” dynamically in your App ready delegate.


Q:
So then it wouldn’t matter if it was a foxpro or JavaScript section since the requery is at the section level and not at the cursor adaptor or recordset level.
A:
Yes thats correct. It only works against VTs as internally it issues a requery() for the VT. The cursoradaptor for the VT knows what section it is bound too so when the requery() completes the section is automatically refreshed.
Also remember that the “where condition” operates just like requery() method on the Virtual Table so it can also contain ORDER BY … LIMIT etc.
So it replaces everything after the WHERE in the Virtual Table definition.
This makes paging of data and changing order much easier.


Q:
I am trying to create a new record whenever the section is loaded. I am trying to do this with the init/ready delegate with the following code:

Code:
Lianja.showDocument("page:gCreateTasks.section:section1?action=add");

A:
That syntax looks wrong, try it in the JavaScript console.

Code:
page: page1.section1?action=add


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s