The DataSheet view in SharePoint doesn’t display edit columns that allows user to go to the edit form of an item right from datasheet view. Why Microsoft didn’t want to add that column? Well, technically you are in edit mode once you are in datasheet view so there is no point (smart huh!!). This limitation, however, can cause some trouble when you are not displaying all of the fields from a list or document library in the datasheet view and this is what I had to face today and made me think what would be a solution. After having some fun with calculated column and formula, I got a good news and a bad news.
First the good news: in order to have that extra column added to datasheet view, I can just add a calculated column with link to the edit form in the formula value. In order to do that,
- Go to the standard view of your list, edit an item and note the item URL in the address bar.
- Create a calculated field in the list or document library e.g., CustomEditLink. The formula that you need to place in the calculated field looks like this:
="http://sharepoint/sites/demosite/Lists/DemoList/EditForm.aspx?ID="& [ID] &"&http%3A%2F%2Fsharepoint%2Fsites%2Fdemosite%2FLists%2FDemoList"
- Uncheck the checkbox so that this column is not added to the default content type and default view if you don’t want to display this column to everyone.
- Select “OK”.
That’s it, if you go to your view or page where you added the list web part and configured it to show the edit link column, you will see the link.
Now the bad news: this solution doesn’t work for new items. The reason is when you add a new item to the list, the ID field is empty and it gets populated after the item is saved. You will need to edit the field by going to list settings and resave it and it will populate the ID field correctly since the item already exist
– or – you can write a workflow that populates field value of this column after an item is created (in my case, this is out of scope of the project :[ so I had to stop)
No comments:
Post a Comment