Looking for XSPDataIterator row setting property

  • I’m building a custom control, and I’d like to hide the pager if there are less than or equal to the value of the “rows=” attribute on a repeat control. That way a change to the repeat control’s row count will produce proper behaviour on the pager, regardless of the row count value. As it is I’ve hard-coded the row cutoff on the pager’s rendered script, but that’s ungainly at best.

  • I see that the repeat control is a XspDataIterator object, and that object must have methods and properties available to it. A search of this forum gives zip. A search of the web yields exactly two hits, which are links to download .nsf files containing demo code for repeat controls.

  • I could write a page to do instrospection and probably noodle it out on my own, but that seems like a lot of work for something an IBMer could simply tell me in seconds. Until then I’ll simply use the ungainly approach of hard-coding it.

Thanks for your time…

Subject: getRowCount()

A real quick way to work this out, is once you know the class you can then use code typeahead to give the methods etc:

So find the class:

typeof(getComponent(componentid))

then see the methods etc:

var c:com.ibm.xsp.component.xp.XspDataIterator=null;

then type c. and you will get your list.

You will see XspDataIterator.getRowCount() is your friend.

Subject: I’m not sure what “type c” means, sadly…

  • I just tried this trick to find other methods on XSPDataIterator for a different purpose, and “type” doesn’t appear to be a known function. I didn’t remember one in JS, but Domino JS has a ton of global functions that aren’t standard, so I tried it. (shrug)

  • Could you illuminate me on what this is? Thanks!..

Subject: THANKS!!!

  • Just what the doctor ordered, including how to find this stuff out later…

Subject: getRows() and setRows()

example:var x = getComponent(“repeat1”).getRows();

getComponent(“repeat1”).setRows(x + 5);

Thomas

http://xpages.notessidan.se

Subject: I think they mean…

In the editor, type the letter “c” and then “.” Since you declared C as type com.ibm.whatever (if you use their code), the auto-complete will show you all the functions available.

Subject: Oh, that

  • It never occurred to me that could be useful! Interesting.

  • I’m so used to that innane annoyance popping at me that I hit “esc” microseconds after it appears. Kind of like a tic, it is. I sooo wish I had to hit a key to pop that freak instead of it magically obscuring huge chunks of the screen “for” me all the time. That goes for auto-everything … I’d like to have to hit a key on a per-occurrence basis to make any of that annoying, resource hogging crud happen.

  • Still and all, I will have to give this a go. Maybe seeing it do something actually useful will make it less annoying.

Thanks Erik, for belaboring the obvious for me!!