Feb 3, 2015 1:14 PM
19 Posts
topic has been resolvedResolved

data binding - what can serve as a data source?

  • Category: Other
  • Platform: All
  • Release: 9.0.1
  • Role: Developer
  • Tags: data binding
  • Replies: 4

OK I understand you can use a NotesView, a NotesView collection, a Notes document, a vector/array as a source for your data binding (to a panel, repeat control etcetera).

 

But what other sources can I define for data binding in XPages and I can bind it to what?

 

I am just trying to understand the vast opportunities compared with traditional Domino development.

Feb 3, 2015 3:01 PM
588 Posts
hmmm

I'm not sure I totally get the question...  but the possibilities are so much more then the notes client...

 

You say "data binding"... that can mean different things in different areas...  So me... an XPage or Custom control can "bind" to a Document, View, or Java Bean.  All that really means it's it's now like a "global variable".  Nothing too fancy really.

An Xpage can't "bind" to a collection or array...  At least I don't THINK so...  not directly...  It can bind to something called "Object Data"...  which to me is similar to a Java Bean... 

A Panel can have a document as a data source... all that means is the document is available to the panel but not outside it...  so it's kinda like an xpage there but with a more focused scope I guess.

Typically I prefer to bind documents and views as high up as possible...  so ideally on the page... then anything can use them...  that's just a preference though as sometimes you do just want them in a custom control or whatever...

A Repeat control is a good control to "bind" to a collection or array or multi-value field.  Then it'll just repeat over all the values....

When it comes to opportunities... that's where the "Java Bean" thing comes into play...  These could be "Managed"... or not...  But once you're using a Java object/bean then you can do anything you want with it...  the data can literally come from anywhere...  so that really does give you the maximum flexibility...

 

Hope that helps.  Let me know if you have any other questions...

Dave

NotesIn9.com

Feb 4, 2015 11:30 AM
453 Posts
extending David's answer

A "fiels"/Repeat Control can bind to a Scoped Variable. I use this a lot. For example I want to enter some information into a control but I don't need/want the data to be saved when the document is submitted then I bind it to a viewScope variable.  It took me a fair while to :Discover" the ScopedVariable binding, IMHO it is one of the most powerful tools in the box. I'm also pretty sure that I have only scratched the surface. 

Also, a Managed Bean returns itself as a scoped variable. So yesterday I created a sessionScope managed bean that returned a list of applications that the user has access to so it has to check a bunch of stuff in several database ACL's, plus a Configuration type document for each application. (pretty involved). Then I had a ComboBox that lists only the Applications that the current user can access. Pretty simple just bind the ComboBox to the sessionScope variable of the Bean. The nice thing is that it only does the calculation Once when the user logs in and saves a bunch of overhead. Could have done much the same thing in SSJS but doubt that it would have been as efficeint.

As a long time N/D developer the switch to XPages was a bit overwhelming because the options were so staggering. If you are just getting started in XPages make sure you get the books from IBM press Mastering XPages and Mastering the Extension Library for a starter. Also, you might want to consider some of the on-line courses offered. I personally took the XPages courses from TLCC and they were very helpful and saved a lot of time.

 

Feb 9, 2016 2:55 AM
19 Posts
data binding - what can serve as a data source?

OK I understand you can use a NotesView, a NotesView collection, a Notes document, a vector/array as a source for your data binding (to a panel, repeat control etcetera).

 

But what other sources can I define for data binding in XPages and I can bind it to what?

 

I am just trying to understand the vast opportunities compared with traditional Domino development.