Skip to main content

Posts

Showing posts from February, 2014

Custom Control Design Definition Tricks

I think by now many people are aware of the Design Definition you can set when creating a custom control. Here is a quick refresher if you are not. A design definition simply replaces what you see when you drop the control on an xpage. By default, it shows whatever is in your control, but this property can be used to replace that with: documentation about how to use the control, for example what custom properties mean or other requirements such as using a data source named "document1" A visual short-hand, for example a control could just show <Header Control> instead of everything inside. This is great for minimizing clutter in the designer and it can also speed up the loading/rendering of the xpage in designer. An interactive tool that allows you to drop additional controls inside  There are a couple of advanced features that can be tricky to figure out unless someone shows you. Here is one:

Problem with naming a custom property "size"

I ran into this issue today and thought I'd share: I created a custom control, and for that custom control I created a few custom properties. One of these properties was unfortunately named "size". There isn't any warning that size would be a bad name for a property, but that causes a problem. It causes a problem because compositeData is just a Map, and size is a method of Map. So what you wind up getting for some reason, is the entire javascript array instead of the value you are looking for. Something like this: {size=md, label={columns=2, text=test}, input={dataBinding=null, columns=10}} I haven't tested it, but I suspect it would be the same with properties named values and clear, among others. However, if you rename the size property, everything works just fine.