PDA

View Full Version : How to build a WebApp consiting of 3 Sections (my problems below)



gcjm
2018-08-03, 11:20
a) The first section is for entering the search term (e.g., last name).
Is realized.

b) From this section, the search term should be passed to a table (for example, second section = grid section).
All surnames (and first names, etc.) that match the search term should be listed in the table.

c) When clicking on a line in the table, the surname and first name should be passed to another section (third section = WebView section).

d) The WebView section then displays other information about the selected person.

I have no problem transferring the search term from a) to d).
My problem is the table between to select a desired person from a number of persons.

And I do not know how the second section (grid) can accept the search term and
I do not know how to pass data of this line to the third section when clicking on a line in the table.
(Colums of a grid do not have a click event!)

Is there possibly an example of the existing examples?

Many Thanks!
Georg

HankFay
2018-08-03, 16:13
Hi Georg,

example_webapp1 on the Territories page has a search field that refreshes the Employee grid below.

There are many other ways to do this (Lianja rarely lacks for options). A lot of learning Lianja starts with reviewing all the example applications and exploring the capabilities in that way. I usually suggest doing 20 minutes a day, and writing down the features that catch your interest, figuring out how to create those features for your apps. Having someone else make the list for you doesn't provide the immersion that makes the list meaningful. Some apps, like example_webapp1, have a lot of features demonstrated, so you'll spend a few of your 20-minutes days on them.

The next step I suggest when you've covered the apps is to create your own versions of the apps using your own tables, and see if you can recreate them without looking at the code. If you can't, then go back to your list and add notes to help you remember those steps.

Extra credit <s>: write a little app to hold all those notes, including the database for them. The upgrade it with features you've learned.

Hank

gcjm
2018-08-08, 10:55
Hello Hank!

Thanks for your recommendations. They are similar to those I gave to my students as a former university teacher :-)

However, Lianja's learning curve is pretty steep, so "reading 20 minutes a day" will not be enough for me :-(, although the articles by Yvonne (or "Yvonne Style") are really good to read ...
Example: https://www.lianja.com/doc/index.php/Section_Search_Panels

I first have 2 questions about the WebApp examples 1 and 2

Example WebApp 1)
Sales.section2 (Customers): It does not matter if I set Auto Create to true or false. It does not change the look and function of the Search Panel. By the way, where are the containers and the Click event functions?

Example WebApp 2)
customers_section1_searchpanel() builds up the "custom searchpanel" correctly, but the functions of both click events do nothing. (I have already put in a messagebox for testing). What else could I try?

Thanks!
Georg

HankFay
2018-08-09, 01:19
Hi Georg,

I agree about Yvonne's docs.

I'll let Yvonne answer your questions as a) she wrote the docs and likely knows the answers without looking and b) I'm heads-down on stuff right now. Otherwise I'd enjoy the challenge. That said, the second question is quite easy: What you are looking for is in the JavaScript code. The container is instantiated there, and the sp_reset_handler function is the delegate for the sp_reset.click event.

enjoy,

Hank

1713

yvonne.milne
2018-08-09, 04:31
Hi Georg,

example_webbapp1: the auto-created search panel is laid out when the App is loaded. Uncheck 'Autocreate' and save and reload the App and you will see the search panel is now blank. For auto-created search panels, the contents are auto-created based on the formitems that have their 'Search panel field' attribute checked.

example_webapp2: For the web client, this would be better:


// lib_customers.js
////////////////////////////////////////////////////////////////
// Handlers for the Search Panel
function sp_search_handler()
{
// Lianja.showDocument("section:section1?action=search&text="+sp_textbox.text);
Lianja.showDocument("page:customers?action=search&text="+sp_textbox.text);
};

function sp_reset_handler()
{
// Lianja.showDocument("section:section1?action=search&text=");
Lianja.showDocument("page:customers?action=search&text=");
sp_textbox.text = "";
};

1. Click the 'Search' menu option
2. Enter a company name to search for, e.g. Ana Trujillo Emparedado
3. Click the 'Search' button to search
4. Click the 'Reset' button to clear the 'Company Name' field in the search panel and return to the top record.

Regards,

Yvonne

gcjm
2018-08-09, 09:01
Hi Yvonne,

Unfortunately, this code does not work either.
Nothing is searched, nor does a reset happen.
I also wrote a "messagebox();" in the code.

But that is not displayed.
There must be something else wrong or missing ...
what my untrained eye does not recognize.

Additionally, I copied the SearchPanel code from WebApp2 example here below.

Such "little things" have always "brought me to despair".
I think the examples should work at least...

Georg


// lib_customers.js

// Handlers for the Search Panel
function sp_search_handler()
{

messagebox("search button clicked");

// Lianja.showDocument("section:section1?action=search&text="+sp_textbox.text);
Lianja.showDocument("page:customers?action=search&text="+sp_textbox.text);
};

function sp_reset_handler()
{
messagebox("clear button clicked");

// Lianja.showDocument("section:section1?action=search&text=");
Lianja.showDocument("page:customers?action=search&text=");
sp_textbox.text = "";
};

////////////////////////////////////////////////////////////////
// Event delegate for 'searchpanel' event
function Customers_section1_searchpanel()
{
sp_container = createObject("container");
sp_container.fixedheight = 30;
sp_container.layout = "H";
sp_container.spacing = 5;
sp_container.addObject("sp_label", "label");
sp_label.text = "Company Name";
sp_label.alignment = "center";
sp_container.addObject("osp_textbox", "textbox");
sp_textbox = osp_textbox;
sp_container.addObject("sp_search", "commandbutton");
sp_search.text = "Search";
sp_search.click = sp_search_handler;
sp_container.addObject("sp_reset", "commandbutton");
sp_reset.text = "Reset";
sp_reset.click = sp_reset_handler ;
Lianja.get("Customers.section1").addSearchPanel(sp_container);
};

yvonne.milne
2018-08-09, 09:56
Hi Georg,

This is all working for me. If you package up your App and attach it to a ticket, I will take a look.

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

Regards,

Yvonne

gcjm
2018-08-09, 11:25
I will do it if I had a little time...
It is your original Example_WebApp2.
Georg


Hi Georg,

This is all working for me. If you package up your App and attach it to a ticket, I will take a look.

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

Regards,

Yvonne

yvonne.milne
2018-08-09, 12:31
Hi Georg,

I am using example_webapp2 here and I cannot see any problems. Are there no other changes you have made, apart from your messagebox() calls?

1717
1714
1715
1716

Regards,

Yvonne

gcjm
2018-08-09, 14:02
Oooooo excuse me! (40C = 104F)

I only checked the DeskView of the example_webapp2, the last days.
In WebView it looks ok!

By the way, is there anything general to say about this behavior for other apps?

Georg

gcjm
2018-08-10, 10:25
Hello Yvonne,

As I have written, example_webapp2 is only ok for me in the WebView, but not in the DeskView.
Is that the same with you?

Strange, however, is that the searching in example_webapp1 (section2) also works in DeskView!

Georg

yvonne.milne
2018-08-10, 10:51
Hi Georg,

No, I cannot see any problems in Desktop App View either.

1718
1719
1720
1721
1722

Regards,

Yvonne

gcjm
2018-08-10, 11:38
No, I cannot see any problems in Desktop App View either.


Can it possibly be related to the fact that I have always loaded new Lianja versions over the old ones?

yvonne.milne
2018-08-13, 04:42
Hi Georg,

If you package up your App and attach it to a ticket, I will take a look.

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

Regards,

Yvonne