ShowDocument() [examples]

Switch to the specified App .

Lianja.showDocument("app:example_webapp2")
showdocument("app:example_webapp2")
  • Supported on the Desktop client only.
  • Alternatively, use Lianja.openApp(), which is supported on all clients.
Lianja.openApp("example_webapp2")

Switch to the specified App and select the page .

Lianja.showDocument("app:example_webapp2:employees")
showdocument("app:example_webapp2:employees")

Applies MetaData attributes for all pages, their sections, and the fields, gadgets and columns in the sections.

Lianja.showDocument("applymetadata")
showdocument("applymetadata")

 

Applies UI presentation rules for all pages, their sections, and the fields, gadgets and columns in the sections.

Lianja.showDocument("applyrules")
showdocument("applyrules")

Sets the UI state(s) specified in the comma-separated string <statelist>.

Lianja.showDocument("changestate:state2,state3")
showdocument("changestate:state2,state3")

Causes all UI components to revert back to their default attributes (no UI state set).

Lianja.showDocument("resetstate")
showdocument("resetstate")

This is the same as clicking or touching the “Hamburger” Pages Menu icon. It is most useful in conjunction with gestures in mobile Apps.

Lianja.showDocument("back:")
showdocument("showpagesmenu")

Navigates to the previous Page in the history.

Lianja.showDocument("back:")
showdocument("back:")

Navigates to the next Page in the history.

Lianja.showDocument("forward:")
showdocument("forward:")

Select the specified Page <pageid>.

Lianja.showDocument("page:employees")
showdocument("page:employees")

Applies MetaData attributes for the page, its sections, and the fields, gadgets and columns in the sections.

Lianja.showDocument("page:page1?applymetadata")
showdocument("page:page1?applymetadata")

Sets the UI state(s) specified in the comma-separated string <statelist>.

Lianja.showDocument("page:page1?action=changestate&state=state2,state3")
showdocument("page:page1?action=changestate&state=state2,state3")

Resets current UI states.

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

Selects the specified page.

Lianja.showDocument("page:employees?action=show")
showdocument("page:employees?action=show")

Redraws the page.

  • Note that this includes right sidebar content gadgets.
Lianja.showDocument("page:customers?action=redraw")
showdocument("page:customers?action=redraw")

Allows the page to be saved as an Instant Report PDF.

Lianja.showDocument("page:customers?action=print")
showdocument("page:customers?action=print")

Hides the Navigation Panel.

Lianja.showDocument("page:customers?action=hidenavigationpanel")
showdocument("page:customers?action=hidenavigationpanel")

Shows the Navigation Panel.

Lianja.showDocument("page:customers?action=shownavigationpanel")
showdocument("page:customers?action=shownavigationpanel")

Hides the left Sidebar.

Lianja.showDocument("page:customers?action=hideleftsidebar")
showdocument("page:customers?action=hideleftsidebar")

Shows the left Sidebar.

Lianja.showDocument("page:customers?action=showleftsidebar")
showdocument("page:customers?action=showleftsidebar")

Toggles the left Sidebar (show/hide).

Lianja.showDocument("page:customers?action=toggleleftsidebar")
showdocument("page:customers?action=toggleleftsidebar")

Hides the right Sidebar.

Lianja.showDocument("page:customers?action=hiderightsidebar")
showdocument("page:customers?action=hiderightsidebar")

Shows the right Sidebar.

Lianja.showDocument("page:customers?action=showrightsidebar")
showdocument("page:customers?action=showrightsidebar")

Toggles the right Sidebar (show/hide).

Lianja.showDocument("page:customers?action=togglerightsidebar")
showdocument("page:customers?action=togglerightsidebar")

Searches for the specified value. Equivalent of using the Instant Search box.

Lianja.showDocument("page:customers?action=search&text=Cactus Comidas para llevar")
showdocument("page:customers?action=search&text=Cactus Comidas para llevar")

Filters the records based on the specified expression.

Lianja.showDocument("page:employees?action=filter&text=employeeid eq 3")
showdocument("page:employees?action=filter&text=employeeid eq 3")
showdocument("page:employees?action=filter&text=firstname eq 'Nancy'")
  • On the Desktop client, the eq OData Operator must be used instead of the = Lianja operator in the filter text expression.
  • On the Desktop client, if the alias pointer is specified in the filter expression, -> must be used (not .).
showdocument("page:employees?action=filter&text=employees->employeeid eq 3")

not

showdocument("page:employees?action=filter&text=employees.employeeid != 3")
  • On the Web/Mobile client, OData Operators must be used in the filter text expression.
Lianja.showDocument("page:employees?action=filter&text=employeeid ge 8")

not

Lianja.showDocument("page:employees?action=filter&text=employeeid >= 8")
  • To reset the filter, use:
Lianja.showDocument("page:employees?action=filter&text=")
showdocument("page:employees?action=filter&text=")

Collapses the top section on the Page.

Lianja.showDocument("page:customers?action=collapse")
showdocument("page:customers?action=collapse")

Expands the top section on the Page.

Lianja.showDocument("page:customers?action=expand")
showdocument("page:customers?action=expand")

Adds a new record and displays it in edit mode.

Lianja.showDocument("page:customers?action=add")
showdocument("page:customers?action=add")

Prompts to delete the current record.

Lianja.showDocument("page:customers?action=delete")
showdocument("page:customers?action=delete")

Refreshes the Page.

Lianja.showDocument("page:customers?action=refresh")
showdocument("page:customers?action=refresh")

Goes to the first record.

Lianja.showDocument("page:customers?action=first")
showdocument("page:customers?action=first")

Goes to the previous record.

Lianja.showDocument("page:customers?action=previous")
showdocument("page:customers?action=previous")

Goes to the next record.

Lianja.showDocument("page:customers?action=next")
showdocument("page:customers?action=next")

Goes to the last record.

Lianja.showDocument("page:customers?action=last")
showdocument("page:customers?action=last")
Lianja.showDocument("page:customers?action=last")

Refreshes the Section.

Lianja.showDocument("section:section1?action=refresh")
showdocument("section:section1?action=refresh")
  • Supported on the Desktop client only.
  • On the Web/Mobile client, page:<pageid>?action=refresh can be used on the Page’s primary Section.
Lianja.showDocument("page:customers?action=refresh")

Toggles edit mode on or off.

Lianja.showDocument("section:section1?action=edit")
showdocument("section:section1?action=edit")
  • Supported on the Desktop client only.
  • On the Web/Mobile client, page:<pageid>?action=edit can be used on the Page’s primary Section.
Lianja.showDocument("page:customers?action=edit")

Goes into edit mode. Remains in edit mode if already active.

Lianja.showDocument("section:section1?action=editmode")
showdocument("section:section1?action=editmode")

Recalculates calculated fields in the Section.

Lianja.showDocument("section:section1?action=recalc")
showdocument("section:section1?action=recalc")

Moves the record pointer by n records, either forwards (n is positive) or backwards (n is negative).

Lianja.showDocument("section:section1?action=move:2")
showdocument("section:section1?action=move:2")
Lianja.showDocument("section:section1?action=move:-2")
showdocument("section:section1?action=move:-2")

Moves the record pointer to record number n.

Lianja.showDocument("section:section1?action=goto:2")
showdocument("section:section1?action=goto:2")

Searches for the specified value.

Lianja.showDocument("section:section1?action=search&text=Ana Trujillo Emparedado")

 

Filters the records based on the specified expression.

Lianja.showDocument("section:section1?action=filter&text=firstname eq 'Nancy'")
showdocument("section:section1?action=filter&text=firstname eq 'Nancy'")
  • Supported on all clients.
  • On the Desktop client, the eq OData Operator must be used instead of the = Lianja operator in the filter text expression.
showdocument("section:section1?action=filter&text=firstname eq 'Nancy'")
  • On the Web/Mobile client, OData Operators must be used in the filter text expression.
Lianja.showDocument("section:section1?action=filter&text=employeeid ge 8")

not

Lianja.showDocument("section:section1?action=filter&text=employeeid >= 8")
  • To reset the filter, use:
Lianja.showDocument("section:section1?action=filter&text=")
showdocument("section:section1?action=filter&text=")

Searches the records within the current filter based on the specified expression.

Lianja.showDocument("section:section1?action=searchfilter&text=firstname eq 'Nancy'")
showdocument("section:section1?action=searchfilter&text=firstname eq 'Nancy'")
  • Supported on all clients.
  • On the Desktop client, the eq OData Operator must be used instead of the = Lianja operator in the searchfilter text expression.
showdocument("section:section1?action=searchfilter&text=firstname eq 'Nancy'")
  • On the Web/Mobile client, OData Operators must be used in the searchfilter text expression.
Lianja.showDocument("section:section1?action=searchfilter&text=employeeid ge 8")

not

Lianja.showDocument("section:section1?action=searchfilter&text=employeeid >= 8")
  • On the Web/Mobile client, call the section refresh after searchfilter:
Lianja.showDocument("section:section1?action=refresh")
  • To reset the searchfilter, use:
Lianja.showDocument("section:section1?action=searchfilter&text=")
showdocument("section:section1?action=searchfilter&text=")


In a Page with Accordion behavior checked (True), selects the specified Section.

Lianja.showDocument("section:section4?action=select")
showdocument("section:section4?action=select")

Applies to TabView Sections. Selects the tab with the specified tabcaption.

Lianja.showDocument("section:section1?action=select&text=Shippers")
showdocument("section:section1?action=select&text=Shippers")

Applies to PanelView Sections. Select a panel by number according to its numeric position (n) in the Panels list:

Lianja.showDocument("page:pageid.sectionid?action=select&text=n")

Select the next panel:

Lianja.showDocument("page:pageid.sectionid?action=select&text=next")

Select the previous panel:

Lianja.showDocument("page:pageid.sectionid?action=select&text=prev")

Enable Cycle:

Lianja.showDocument("page:pageid.sectionid?action=select&text=cycle")

Applies UI presentation rules for this sections and its fields, gadgets or columns.

Lianja.showDocument("section:section1?action=applyrules")
showdocument("section:section1?action=applyrules")

Sets the Section SQL statement attribute to the specified sqlstatement.

Lianja.showDocument("section:section1?action=sql&text=\
select * from orders where customerid eq '{customers.customerid}' limit 2")
showdocument("section:section1?action=sql&text=\
select * from orders where customerid eq '{customers.customerid}' limit 2")

Sets the Section Where condition attribute to the specified queryexpression.

Lianja.showDocument("section:section1?action=where&text=customerid eq 'WILMK'")
showdocument("section:section1?action=where&text=customerid eq 'WILMK'")
Lianja.get("pageid.sectionid").where = "customerid eq 'WILMK'"
Lianja.get("pageid.sectionid").requery()

Requeries the backend data source using the specified queryexpression to replace the WHERE clause condition and any other clauses that follow it such as LIMIT or ORDER BY.

Lianja.showDocument("section:section1?action=requery&text=\
customerid eq 'WILMK' limit 2 order by employeeid")
showdocument("section:section1?action=requery&text=\
customerid eq 'WILMK' limit 2 order by employeeid")
  • Note that the ‘WHERE’ keyword itself should not be included.
  • The eq OData Operator must be used instead of the = Lianja operator in the queryexpression.
  • In versions prior to 3.0, supported on the Desktop client only.
  • To requery removing the WHERE clause and any other clauses that follow it, use:
Lianja.showDocument("section:section1?action=requery&text=")
showdocument("section:section1?action=requery&text=")

https://www.lianja.com/doc/index.php/Using_the_showdocument()_function_and_Lianja.showDocument()_method


When the Customer Accounts menu option is clicked, the Lianja.showDocument method is used to switch to page1.

////////////////////////////////////////////////////////////////
// Event delegate for 'customsectionmenu' event
function startpage_section2_customsectionmenu(arg)
{
    if (arg == "Customer Accounts")
    {
	Lianja.showDocument("page:page1");
    } else if (arg == "Employees") {
	messageBox("Employees selected");
    } else {
	messageBox("Products selected");
    }
};

https://www.lianja.com/doc/index.php/UI_Presentation_Rules


Perform a Lianja UI action or display a document in its associated plugin/application

// Lianja UI Actions
showdocument("app:myapp")
showdocument("page:page1")
showdocument("page:page1?action=hide")
showdocument("page:page1?action=show")
showdocument("section:section1?action=select&text=Order Details")
showdocument("section:section5?action=print")
showdocument("section:section6?action=last")
 
// Accessing local files using '.pdf' and '.docx' file associations
showdocument("file:///C:\Users\Myuser\Documents\Documentation for HR\Attachments\Resume.pdf")
showdocument("file:///C:\Users\Myuser\Documents\Documentation for HR\Attachments\Resume.docx")
 
// Remote ftp URL
showdocument("ftp://ftp.mycompany.com/latest.txt")
 
// Example to create an HTML file display in the default browser
fp = fcreate("htmlfile&(getpid()).htm")
fwrite(fp, "<html>")
fwrite(fp, "<body>")
fwrite(fp, "<table>")
fwrite(fp, "<tr>")
fwrite(fp, "<td>Field1</td>")
fwrite(fp, "<td>Field2</td>")
fwrite(fp, "</tr>")
fwrite(fp, "</table>")
fwrite(fp, "</body>")
fwrite(fp, "</html>")
fclose(fp)
showdocument("htmlfile&(getpid()).htm")

https://www.lianja.com/doc/index.php/SHOWDOCUMENT()


 

Advertisements

ShowDocument

Incredibly powerful, but possibly less well know, is the showdocument() function and the corresponding Lianja.showDocument() method.
Here are some of the operations you can do with showdocument() and Lianja.showDocument():

  • Switch to another App
  • Switch to another Page
  • Navigate records: First, Previous, Next, Last, move relative, goto record number
  • Initiate data operations: Add, Edit, Delete
  • Search and filter data
  • Refresh ‘Visible when’ and ‘Readonly when’ Rules at Section or Page level
  • Change or reset UI States
  • Navigate to the previous or next Page
  • Hide or show the left and right Sidebars
  • Hide or show the Navigation Panel
  • Expand and collapse Sections
  • Select a particular Section in an accordion Page
  • Select a particular Tab in a TabView Section
  • Dynamically change Virtual Table queries

 


Q:
Is there an advantage to using Lianja.showDocument() method other than the ability to chain commands in a single call (which is very nice)? IOW, can all the same actions/settings be accessed using Lianja.get()? I ask because I seem to remember at one point that some things could only be done using showDocument.
A:
There are certainly some that are showdocument only – the hide/show of the navigation panel and sidebars and the UI States spring to mind.
Others are standard
section or pagemethods and will be calling the same code behind the scenes.


there should be only one colon, if used, following the first name: that tells the Get method of Lianja which part of the hierarchy to start searching.

So if section1 is on pgCreateTasks, your parameter to showDocument would be as below. Note that if you are starting at page level, the page: isn’t needed.

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

 


Unlike Lianja.getElementByID(), Lianja.showDocument() needs to have a prefix of “section:” so that the specified action is performed against the section.


Q:
When using showdocument in a web browser, I can do a search on a section as follows.

Code:
Lianja.showDocument("page: page1.section3?action=search&text=King");

This will search on my search field (which is lastname) for King.
If I wanted to filter a section, what is the correct syntax?
This is clearly not correct.

Code:
Lianja.showDocument("page: page1.section3?action=filter&text=lastname = 'King'");

A:
From the new treeview app .js file:

Code:
function page1_section1_dblclick(title, key)
{
    Lianja.showDocument("page: page1.section4?action=search&text="+key);    
};
Code:
Lianja.getElementByID("page1.section4").refresh();

here is the OData syntax.

Code:
Lianja.showDocument("section:section2?action=filte r&text=contactname eq 'Jean Fresniere'"); 
Lianja.showDocument("section:section2?action=filte r&text=contactname eq ''");


ShowDocument

// Event delegate for 'ready' event
function page1_ready()
{
        Lianja.showDocument("page:page1?action=add");
}

or

Code:
////////////////////////////////////////////////////////////////
// Event delegate for 'ready' event
function page1_section1_ready()
{
        Lianja.showDocument("page:page1?action=add");
}

Create new record whenever the section is loaded


Sounds like you want to use the Stacked behavior Accordion I mentioned earlier or maybe you should have individual Pages. Remember you can change pages using Lianja.showdocument(“page:ageid”) and Lianja.showdocument(“page:ageid?action=do_this”).
You can also
set the Page Attribute to ‘Hide page from menu’ at runtime so users can’t switch to it until you want them to.


From Lianja v1.3, the “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")