Page

Q:
I navigate to a different page using Lianja.activePage = page2 & the new page opens just fine. I want to do some things when the page loads (move to a desired record or start add mode etc.). A few questions:
– I did some tests and page load/init/ready all fire when the app starts and never again, am I right in assuming that all pages load up at the start of the app?
– What event could I use to setup a page when navigating to it as above?
A:
Events are called in the order (ILRA)
init,
load,
ready
and then
activate for the active Page/Section.

When you navigate to a Page, its activate event is called.

Have a look at SHOWDOCUMENT() / Lianja.showdocument() for UI operations such as selecting a Page and searching within it
Lianja.showDocument() and Lianja.getElementByID() are core to working with the Lianja Object Model. I would suggest you familiarize yourself with the Lianja system object.


If you have a lot of pages it may be better to spilt it up into several apps.
You can
switch between apps using Lianja.openApp()


Q:
I have an app with two pages, when I switch to the second page, my data is synced with the first page as it should be.
However, when I
return to the first page using a command button, the table I am using is closed and I have to reopen it manually or add a use field in my activate delegate, but when I do this, it defaults to the first record.
I looked through my code and cannot find
where the table is closing. Is there a delegate that will keep the table open on my first page so when I return to it, it is still on the same record?
canvas sections on both pages
A:
Are you querying a table which is bound to a section? If you are you need to wrap that code in:

Code:
SAVE DATASESSION
...
RESTORE DATASESSION

Which will maintain the context of the open cursors.
QA2:
you got me looking at a section where I had an unneeded select command for a database that was already in use. Problem solved.


Q:
Is it possible to establish a child parent relationship between sections of two pages?
A:
No. Sections belong to one page.


Q:
So If I want to use the same data on a new page, should I save the index field to a memory variable and filter the table on the new page/section to get the same record data or is there a better way to link two sections.
Basically I am choosing an address record from one page and starting an invoice with the same record on a new page by saving the data memory variables.

I have both sections one on the first page and the other on the second page pointing to the same database and table. When I go to the second page, it is not point to the same record in the table. Almost like it needs a parent – child relationship.
A:
If the sections are bound to the same data, navigating between pages will do that automatically. There is no need to save anything in any variables.
Hint: Look at using Lianja.showdocument(“page2.section1?action=search& text=” + yourkeyexpression) in the activate delegate for page2 to keep them in sync.
A2:
If you were really doing parent/child with grids, and they were on separated pages, there is a way to do that also.

If you are using views, you would set the WHERE of the child page to the PK value of the parent record, when Activating the page.

If you are using table, you would set the FILTER of the child page in the same way.

If both cases you would use a macro expression, like so:
parentfk = {parent.pk}

In desktop apps, even in JavaScript, resetting the WHERE in the Activate of the child section is all you need to do to refresh the child.

Code:
Lianja.get("pgChild.scChildGrid").where = Lianja.get("pgChild.scChildGrid").where

add the semi-colon for JavaScript.


you want the page, on opening, to show no records. The reason it is not doing so is that you are in the development environment, and when you set the REQUERY property it is saving.
That’s right: you can set properties by executing commands in development mode, and the values get saved. That’s a great thing (think: builders). This
wouldn’t happen in the deployed app.

So: what you can do is set the REQUERY back to 1=0 in the READY of the section, and the app will start with no records.
While
testing, you can “refresh” the app to make this happen. In scenarios where you want all records to show, you can set it to 1=1 in the READY.


Q:
I’ve try to set the page parameter “Query page”, but I do not see change when I load the page.
A:
That setting is used when you have a web app that does not initially load data.
It is telling Lianja not to automatically try and populate the data.

This is really for instances when you create a virtual Table using the where 1 = 0 clause.
To populate the data after the page has loaded, you would set the where (or filter) clause at runtime.

Code:
Lianja.get("page.section").where = 'employeeid =1'


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