be cool, be with FP1 :)
Saturday, December 18, 2010
Monday, December 13, 2010
I've just passed exam #190-951. IBM Lotus Notes Domino 8.5 Application Development Update
with 85% that is not bad but from another side it means I still need to learn a lot.
Monday, December 06, 2010
Expand and Collapse views in xPages
Found very nice solution
Collapse all
Expand all
That's much better then save values in sessionScope/RequestScope and use property expandLevel in viewPanel.
Collapse all
var viewPanel = getComponent(compositeData.viewPanelName);
var model:com.ibm.xsp.model.domino.DominoViewDataModel = viewPanel.getDataModel();
var container:com.ibm.xsp.model.domino.DominoViewDataContainer = model.getDominoViewDataContainer();
container.collapseAll();
Expand all
var viewPanel = getComponent(compositeData.viewPanelName);
var model:com.ibm.xsp.model.domino.DominoViewDataModel = viewPanel.getDataModel();
var container:com.ibm.xsp.model.domino.DominoViewDataContainer = model.getDominoViewDataContainer();
container.expandAll();
That's much better then save values in sessionScope/RequestScope and use property expandLevel in viewPanel.
Tuesday, November 16, 2010
JS staff: Use Object instead of Switch.
Well, many of us use switch to solve own tasks, but there is another way I would like to show. We can use Object approach to solve our problem and it looks more intelligent from my point of view.
Let me show couple examples
1. Example with switch
function FoodType(food) {
var getfoodtype;
switch(food) {
case 'apple': getfoodtype = 'fruit'; break;
case 'cucumbers': getfoodtype = 'vegetable'; break;
case 'watermelon': getfoodtype = 'strawberry'; break;
default: getfoodtype = 'not recognized';
}
return getfoodtype;
}
var getfoodtype, case, and break, we can avoid them.
2. Example with Object
FoodType {
apple: fruit,
cucumbers: vegetable,
watermelon: strawberry,
GetFoodType: function(type) {
return(this[type] || 'not recognized');
}
}
Ofc there could be cases where Object approach does not work and we have to use switch, but it is alternative, so keep in mind this.
Let me show couple examples
1. Example with switch
function FoodType(food) {
var getfoodtype;
switch(food) {
case 'apple': getfoodtype = 'fruit'; break;
case 'cucumbers': getfoodtype = 'vegetable'; break;
case 'watermelon': getfoodtype = 'strawberry'; break;
default: getfoodtype = 'not recognized';
}
return getfoodtype;
}
var getfoodtype, case, and break, we can avoid them.
2. Example with Object
FoodType {
apple: fruit,
cucumbers: vegetable,
watermelon: strawberry,
GetFoodType: function(type) {
return(this[type] || 'not recognized');
}
}
Ofc there could be cases where Object approach does not work and we have to use switch, but it is alternative, so keep in mind this.
Friday, November 12, 2010
Dynamical counter in Lotus Notes client
Have you ever tried to show length of field (f.x. just below the field) ?
Let me show my example, I've a form, there I have couple fields I need to show length of it (because there is some validation of length for this field).
So when user input new char in Title field, Character count should increase to 1. Know how to do that? I believe many of you know, but anywhere I would like to share this approach.
There are actually 2 fields: 1 for input and another one is just below the Title of field (computed type).
What we need to do - use some simple JavaScript lines..
step 1.
go to JS Header even in form/subform and put there couple lines of JS (select Run: Client and JavaScript)
step 2.
select input-field, and go to onFocus event, select Run: Client and JavaScript and put there 2 lines
step 3.
select input-field, and go to onBlur event, select Run: Client and JavaScript and put there 1 line
That's all.
Let me show my example, I've a form, there I have couple fields I need to show length of it (because there is some validation of length for this field).
So when user input new char in Title field, Character count should increase to 1. Know how to do that? I believe many of you know, but anywhere I would like to share this approach.
There are actually 2 fields: 1 for input and another one is just below the Title of field (computed type).
What we need to do - use some simple JavaScript lines..
step 1.
go to JS Header even in form/subform and put there couple lines of JS (select Run: Client and JavaScript)
var f = document.forms[0];
var stopDynamicalCounter = 0;
function updateCharCounter(delay) {
if(stopDynamicalCounter == 0) return;
f.AlternateTitle_length.value = f.AlternateTitle.value.length;
setTimeout( 'updateCharCounter( ' + delay + ' )', delay);
}
step 2.
select input-field, and go to onFocus event, select Run: Client and JavaScript and put there 2 lines
stopDynamicalCounter = 1;
updateCharCounter(100)
step 3.
select input-field, and go to onBlur event, select Run: Client and JavaScript and put there 1 line
stopDynamicalCounter = 0;
That's all.
Subscribe to:
Posts
(
Atom
)