Sunday, May 22, 2011

Hide When in XPages

To hide an Xpage Controlsbased on a  formula.

Under the All properties of the Control,We have Rendered and Loaded property. Using either one of these properties we can  hide or display the component.

<xp:button value="Label" id="button1">
        <xp:this.rendered><![CDATA[#{javascript:context.getUser().getRoles().contains('[Configuration]')}]]></xp:this.rendered>
    </xp:button>

In this case, only if the role "Configuration" is enabled for the current user, then this button will be visible.

When we use the "Rendered" property, the Control will be generated by the server but it will  not be displayed.  However if we use Loaded, the Control will not be generated by the  server

Wednesday, April 20, 2011

Dbsearch in XPages

I landed upon 2 good resources for db search in XPages.
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/XPagesViewControlAddFullTextSearch.htm

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=/com.ibm.designer.domino.ui.doc/wpd_tutorial_enhancing.html


I tried to combine the search and type ahead functionality.  For the search query box, I have enabled the type ahead function and upon clicking the submit button the dbsearch is successfully performed. Now I'm trying to remove the submit button, once I select a value from the type ahead, the search should automatically performed.  Any idea on how to do this

Tuesday, April 19, 2011

Type Ahead in XPages

Type ahead is a cool feature which i would love to have it in notes client based application.  When I started to explore about x pages, the first thing that I looked for is Type ahead.  When I googled for type ahead I ended in the following pages.
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/XPagesTypeAheadValueMarkup.htm
http://www.bleedyellow.com/blogs/YellowNotes/entry/xpages_type_ahead_feature_with_large_view2?lang=en

Based on the above, I developed the below code.

<xp:inputText id="inputText1">
        <xp:typeAhead var="startValue"  mode="partial" minChars="3" ignoreCase="true" id="typeAhead1">
        <xp:this.valueList><![CDATA[#{javascript:var db1 = new Array("", "xpages\\chapter10.nsf");
        key1 = startValue;
        var ret = new Array();
        ret = @DbLookup(db1, "By Author", key1, 1 ,"[PARTIALMATCH]");
       
        @Unique( ret );}]]></xp:this.valueList>
        </xp:typeAhead>
    </xp:inputText>




Note : The view shouldn't be categorized. If the view is categorized, then only first value would be returned.





XPages

I started my IT Career with Formula language and Lotus script. Even though I have worked on Java and PHP, Lotus script and Formula language are my cup of tea. Ever since IBM announced about XPages, I was really scared. Since I don't have a formal Java knowledge I feared a lot about Domino Designer in Eclipse. But now XPages has become the reality.  I started to learn it in the hard way. There were lot of websites and wiki for XPages application development. But still they didn't answer many of my questions. In this blog, I have tried to explain few things which I have learned/learning in XPages.