22 March 2012

Short text contents by size on client side

This time I bring code that can help you with working with text.
The following code is the client side (javascript - jquery) and receive text and shortens it. Finally, it adds three dots (...)

// -- Fix width size, add "..." if the size is big --
// Example:
// Before:
// <p id='MyID'>text text text text</p>
// ...
// var el = $('#MyID'); 
// FixWidthSize(el, 10);
// ...
// After: 
// <p id='MyID'>text text ...</p>
function FixWidthSize(el, size) {
    var originalText = el.html();
    var w = el.width();
    var text = originalText;
    while (text.length > 0 && size < el.width()) {
        text = text.substr(0, text.length - 1);
        el.html(text + "...");
    }
}

So it seems, before and after

Yours,
Roi

06 March 2012

A sharepoint list view of the current month

Who has not asked to make view of the current month?
And every time we need to reinvent the wheel.

This time I'll show how to do this:

Need to create two columns
1. Start of the Month
2. End of the Month
Two columns need type -"calculated"

The formula of "Start of the Month"

=DATE(YEAR(Created),MONTH(Created),1)



The formula of "End of the Month"

=DATE(YEAR(Created),MONTH(Created)+1,1)-1

The view definition in the "Filter":

"Start of the Month" is Less than or Equle to [Today]
Or
"End of the Month" is Greater than or Equal to [Today]

Here is the result:
Hope i helped,
Roi