Tuesday, February 10, 2009

How to colorize your SharePoint List

By Sveta Yerpilev
SharePoint Technical Consultant
KWizCom Professional Services – www.kwizcom.com

******
Our work often necessitates creating solutions as we go.
One day I was asked to show the status of the items in a SharePoint list with colors or, in other words, to categorize by colorizing.
The idea was for users to populate the list by choosing the status from a checklist (simple) and then be able to see the color coded status on the homepage automatically (how do you do it?).
This is the solution I came up with:
First I created a list with column labeled “Status” that could get the values “Ready”, “Not Working” or “Not Ready”.
Then I created an additional column labeled - “Status Icon”. I made this a calculated column – each field gets their value according to the value of the “Status” field of same item. This column actually contained links to pictures where the link changes according to the value in the “Status” field.

Here is the formula for the calculated column:

=IF(Status="Ready","pictureLibrary/ready.jpg",IF(Status="Not Ready","pictureLibrary/notready.jpg",IF(Status="Not Working","pictureLibrary/notworking.jpg","Not Working")))

Ok, now we have a link to the right picture, but how do we see this picture on the page?
To do this we need to use the Data View Web Part that is available only in SharePoint Designer, so we must edit the page in the SharePoint Designer to add Data View.
After adding this web part we need to add columns from our list to the web part.
Note - we add the “Status Icon” column ONLY and NOT the “Status” column!
After we do this we need to change the format of the “Status Icon” values to “Picture”. Now we will see all of the values in the “Status Icon” column as images.We can also change the title of the column to “Status”.

Here is how it looks in the end:


Post Script - the scenario detailed here occurred before I learned that calculated fields can contain HTML. Utilizing this option enables us to avoid SharePoint Designer all together although my solution was fairly simple so I suggest picking whatever you are most comfortable with – either way will do the trick!

You can find more information on this subject at this great blog:
http://pathtosharepoint.wordpress.com/category/calculated-columns/
****************************
For more helpful tips and guidelines please visit our blog: http://kwizcom.blogspot.com/ You can try KWizCom add-ons free of charge at: http://www.kwizcom.com/

Saturday, February 7, 2009

KWizCom announces CRM SharePoint Connector version 2.2.00

KWizCom recently released our CRM SharePoint Connector version 2.2.00.
You can read more about it and its business benefits
here.

If you are interested in being updated on KWizCom new releases as they come out please register for the official KWizCom rss feed here.

Tuesday, February 3, 2009

Load Your SharePoint "View" Page Faster

By Roi Kolbinger - SharePoint Consultant KWizCom Professional Services – www.kwizcom.com

Did you ever notice that SharePoint pages that display "views" loads slower if you have set a default site direction?

When I open a list view (allitems) with Firefox it loads in a second, with Explorer the same page loads in three seconds. Why?

When considering it two extra seconds may not seem like a lot but the extra moment here and there end up being wasted hours sucked up by the computer. Who have us hasn't sat down to work on a project and after what feels like moments, raised eyes to the clock only to find that in actuality hours had flown by? Every moment is precious and I wanted to discover why the page was loading so much slower…

Curious, I decided to investigate… I began by debugging the JavaScript page using a small function called "FixTextAlignForBidi". This function verifies that your browser is Explorer. If it is, this application runs all the elements on your page and changes the textAlign (left or right) according to what you defined when you created the list.


If you use "none" as your default this function will not run and your page will load faster.

If that doesn't work then a different solution is needed.

Once I discovered the source of the difficulty I was able to figure out how to fix it:

If you use one language on your sites, go to init.js, find the function and add a return method at the beginning like so:

function FixTextAlignForBidi(value)
{
return;
if (!browseris.ie)
return;
...


After this, go to core.css (or your style file) and add this code to create a default textAlign:

Left alignment:
/* FixTextAlignForBidi(left) on init.js */
.ms-vh-icon, .ms-vh-icon-empty, .ms-vh2-nograd, .ms-vh2-nograd-icon, .ms-vh2-nofilter, .ms-vh2-nofilter-icon, .ms-vhImage
{
text-align: left;
}


Right alignement:
/* FixTextAlignForBidi(right) on init.js */
.ms-vh-icon, .ms-vh-icon-empty, .ms-vh2-nograd, .ms-vh2-nograd-icon, .ms-vh2-nofilter, .ms-vh2-nofilter-icon, .ms-vhImage
{
text-align: right;
}



If you use two directions on your site you can attack the problem a few ways.

One way is to create two style sheets and add to the files the code as appears above.
An alternative is to allocate the faster speed to the main alignment direction you are using, for example:

If you choose the left side to be the faster one you add the left style to the css file, and in the JavaScript function you add if
function FixTextAlignForBidi(value)
{
if (!browseris.ie)
return;
if (value == "left")
return;

...

If you chose the right side, do the opposite.

After that you should have no more difficulties with the loading speed of your pages.

******************
For more useful tips and guidelines please visit the KWizCom blog at: http://kwizcom.blogspot.com/
You can try KWizCom SharePoint and Dynamics CRM add-ons free of charge: http://www.kwizcom.com/