PDA

View Full Version : Custom WebViews in Web/Mobile Apps



barrymavin
2015-03-01, 21:11
When building your own custom WebViews that are dynamically generated by .rsp or .jssp pages, if you need to interact with the Lianja Object Model of the App containing the WebView or you need to share the Lianja object instance you should place the following code in the head of your HTML code.



<head>
// We don't need to do this in development mode just in live web app running in a browser or mobile device
if (typeof LianjaAppBuilder === 'undefined') window.Lianja = window.parent.Lianja;
</head>


You can then use the Lianja methods e.g. Lianja.getElementByID(), Lianja.showDocument() etc in your Javascript code that you have in the WebView.

HankFay
2015-03-01, 21:18
Excellent!

This will make webviews a powerful tool in web apps.

hmischel@diligentsystems.com
2015-03-01, 21:21
This is just what I have been looking for!

Thanks Barry!

HankFay
2015-03-01, 22:38
.rsp or .jssp pages

That would seem to imply that whether a .rsp or a .jssp, the page will run on the server, not on the client. That's OK, just checking.

thanks,

Hank

hmischel@diligentsystems.com
2015-03-01, 22:54
Wow - this is really fantastic.

If you think about it, this is a great example of how easily one can extend the framework.

Allowing the webview to interact with the rest of the framework cant be understated.
This opens up incredible opportunities.


Use the standard sections where you want them, use any type of JavaScript library that you want to include.

It's unprecedented.

Have a quick look at what I just threw together. I'm using a JQuery accordion, the bootstrap table and an existing showdialogpanel.

I plan on putting some really slick apps together with these in the next couple weeks.

I couldn't insert the video, so here's a link.

https://www.youtube.com/watch?v=FXUtccC4Xcw&feature=youtu.be


Herb

barrymavin
2015-03-01, 23:11
.rsp and .jssp files are executed server side and generate dynamic HTML5 and JavaScript.

In the client-side JavaScript functions that you can attach to various event handlers you can then use Lianja.showDocument() etc as described in the previous post.

There is a clear separation between what runs on the client and what runs on the server however the LianjaWebFramework does in fact allow you to call server-side business procs as you are aware.

Once you get your head round this you will see the power of being able to integrate the client and the server using the LOM and the Lianja system object accessible from the web / mobile client.

HankFay
2015-03-02, 10:05
Hi Herb,

great example: thanks!

Hank

hmischel@diligentsystems.com
2015-03-02, 13:28
Thanks Hank.

Fortunately, Barry cleaned it up a bit and put a similar version in the next build called example_jqueryui.

It's makes it clearer how the formatting should be handled.

Herb