Sharing new technologies and best practices

 
alt

Chris Connor

 
Follow ChrisJConnor on Twitter
Chat with me

Getting handle to XPages repeat control data in different places

Chris Connor  March 4 2011 06:29:23 AM
Needed this kind of functionality in at least a couple of occasions now. You have a view and to that view you bind a repeat control. You then tie a search to the view so you can display searched results in a repeat control. In many circumstances you will want to present further functionality based on the searched data set (perhaps an export to excel or a filtering series of checkboxes or ...well about anything).

The key is we need to get a hold of the repeat control, get the underlying data source (searched data - called by getModelData), then the documents "beneath" (from each row by using getRowData()). Well - it is fairly straight forward as below.


var temprows=getComponent("repeat1");

var modelData=temprows.getDataModel();

for(i=0; i < modelData.getRowCount() ; i++){

        modelData.setRowIndex(i);

        var xspViewEntry=modelData.getRowData();

        var document=xspViewEntry.getDocument();

        BeanPickerList.setArraylist(document.getItemValueString("Type"));

}

For your information "BeanPickerList" is just a simple ManagedBean that I manipulate in a few places in my application. But the idea is that you get a handle to the NotesDocument. From there you can do anything that you normally do in the Notes world...

Comments

1ChrisC  03/04/2011 7:22:25 AM  Getting handle to XPages repeat control data in different places

PaulSWithers asked...

"Presumably the data type of modelData.getRowData depends on what you're throwing into the repeat, right?"

Paul - Not tried anything else. It is an abstract class. The method returns an object so I am guessing (without investigating the class heirarchy further) that you should be able to work with a different range of collection type data. This is native stuff - so the fact that repeats work with all sorts of collection data would back that up.

Paul - apologies for deleting your post. Error on my part as I was trying to delete a double post by me!!

2wei  03/09/2011 9:06:41 AM  Getting handle to XPages repeat control data in different places

Hi

Chris, I was trying to perform FTSearch on the view which is wrapped in datamodal in a repeat control, but did not success.

view datasource and document datasource are xpages runtime objects that buffer in the view and document, I tried hard to manipulate these runtime object, but only able to play with document , but not view

you have any idea to manipulate view datasource (not document datasource)?

About Me

Java / Web Development consultant with 17 years experience. Focus on XPages, Java / JSF / J2EE, Websphere Portal, Spring / Hibernate, RCP, jQuery, Dojo, RCP, Eclipse, RAD, Phonegap and general Mobile development. Experienced public speaker at several global events.

My day job is building Web applications for my customers using the best technologies for the job. This blog discusses the issues in delivering these modern collaborative solutions.

I am available for hire through my business BSS IT Solutions. We are an IBM Business Partner based in Scotland serving the UK and beyond!