Many of you out there in SharePoint land will from time to time have the need to edit a list definitions schema.xml file to create your custom list. You may also have need to edit the List View in that schema file to create a different kind of view, one not possible to create by the SharePoint UI.
I have had need to do this recently. I needed a List View that highlighted expired items or tickets in my list. It needed to make them go red.
Now you might think that’s easy enough create a calculated field that does date maths on the date you have in the list item and the current date that gives basically 1 or 0 for expired or not. Well you’d be wrong. You see you can’t use [Today] or anything like it in a calculated field the list wants fixed not dynamic values in it and will not allow Dynamic values, think about it, it would seriously effect performance.
Rather than create a DataViewWebPart based on my list view and edit that to death, it did not give me exactly what I required, even with editing, and the time to do it would be longer for me to achieve. I decided to embed Javascript code into my ListView.
Read the rest of this entry »