Archive for the ‘Page’ Category

Page

Posted: 2017-01-21 in 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'


Page

Posted: 2017-01-21 in Page

I have added a new attribute in the page attributes “Full page edit“. This causes all sections on a page to be edited when the “Edit” tool button is clicked in the navigation bar (at the bottom) or the page is switched into edit mode using

Lianja.showDocument("page: page1?action=edit")



This provides for a better user experience when a page is laid out in multiple sections and you want to edit the complete “DataView” as opposed to just the main form section that has the “Search Key” field defined.

“Full page edit” also applies to Add – clicking the Page’s Add button or from an Add action:

Code:
Lianja.showDocument("page: page1?action=add")

Q:
how do I delete an object that is created?

Code:
myform = createobject("form")

A:

Code:
release myform

or

Code:

<pre class="bbcode_code"myform = .f.

If the form is displayed you need to close() it or release() it.


Q:
to declare a variable that is visible to all sections within a page
A:
Just put it in your namespace in the page init delegate.
e.g.

Code:
namespace PeopleKiosk 
public MyVar = 0

If you wanted to reference a formitem in the ‘Customer’ Form Section in example_webapp3, you would use the Lianja.get() syntax, e.g.

Code:
////////////////////////////////////////////////////////////////
// Event delegate for 'click' event
function page1_section2_field23_click()
{
        m_companyname.text = "";
        m_companyregion.text = "";
        messagebox(Lianja.get('page1.section1.field1').text);
}


Page

Posted: 2017-01-21 in Page

Q:
How do you change pages programaticaly ?
A:

lianja.showdocument("page:mypage")

Showdocument(), which can be called as a function or as a method on the Lianja System Object.


Q:
If the page on which the user enters the sales order, after entering the account code, I want to display all of its sales quotation ..
I can use a Sidebar, where I show the list the valid offers?
A:
If you want a ‘Sidebar’ (and not the standard left sidebar with logo, menu, favorites etc.), you can use a Lianja.showdialogpanel() to display a UI Page or a Page Navigation Panel set to use a ‘Custom UI page‘.
Either of these would allow you to design a Page with your required Sections and set/get values using Lianja.get(“page.section.field”).property.

You also have the option of using the Page Right Sidebar with a Custom Content Gadget based on an rsp script containing VFP/HTML/JavaScript.


Q:
If I set the Page Header to Visible = .F., the headerbar is shown, even if in the Apps Setting Hide Header Bar = .T.

A:
That’s to allow for Page navigation when you have no Page Header and no Left Sidebar with the Page menu.