Posts tonen met het label Webpart. Alle posts tonen
Posts tonen met het label Webpart. Alle posts tonen

donderdag 13 september 2012

Hide a webpart or Columns of a ListView webpart.


Found some interesting JQuery for hiding a SharePoint Webpart, 
or some columns of a ListviewWebpart.
This can be usefull if you have some columns that are language depentend. 
So of that moment you can hide for example a column with dutch text 
or an other column with other information. 
Or if you want that someone has less columns than another user 
in the same view and you don't want to duplicate the views. 

My example below will hide a complete webpart and the first three columns 
of a ListView webpart.
Attention, if you have more than one listView webpart on your page, 
all the same columns will be hidden.

If you know how I can determ to hide the columns of a specific webpart... 
I'm interested in the code.


$( document ).ready( function() {
 // hide new webpart
 $(MSOZoneCell_WebPartWPQ5).hide();
 // hide column 1, 2 and 3           
    $(".ms-listviewtable,.ms-emptyView").find("td:nth-child(1),th:nth-child(1)").hide();     
    $(".ms-listviewtable,.ms-emptyView").find("td:nth-child(2),th:nth-child(2)").hide();     
 $(".ms-listviewtable,.ms-emptyView").find("td:nth-child(3),th:nth-child(3)").hide();      
});


 

donderdag 2 augustus 2012

Custom Webpart Page with Attachments


What a day, searching for several hours to found out how it come's 
that the attachment functionality didn't work at a custom aspx webpart page.
After searching and searching I found the solution. 
You may not use New/Edit/Display Form directly from your list, but use it via the Custom List Form. 
Otherwise the Attachment functionality will not be provided and I hadn't found
a way to let it functioning. 
So far even that I didn't got an error message anymore and that the attachment 
wasn't saved into your item.

So how to do it... Follow these steps:
 
1.       Create a custom list.

2.       Open that site in SharePoint designer, 
         and create a new web part page in Site Page, 
         then open it in advanced mode.

3.       Then new web part page is opened. 
         Click Insert > New Item Form > Custom List Form > 
         Select that custom list to use for form > 
         Select Item content type to use for form > 
         Select New item form to create > 
         Keeping Show standard toolbar is checked > Click OK.

Then I can get a SharePoint:FormToolBar with Attach File and Spelling options. 
Then save and preview this page, you can see the toolbar in the ribbon is enabled.
Go back to the web part in SharePoint Designer, 
and delete the SharePoint:FormToolBar control, 
save the page and preview it, we can see, 
the toolbar with Save, Cancel, Paste and Attach File buttons is disabled.