I'm building a bulletin board site (in 2010) and I'm sure this must be simple but again it doesn't seem so. Anyway on my default page I have a query webpart showing the latest items and what I need is just a button at the top of the page "Add new item" which would show the popup and allow users to complete the form just like it works on the display list items form.
I've looked at AllItems.aspx but can't even see the "Add new item" button to copy!
Any ideas?
Thanks
Dan
This is actually very easy. You need to know the address for your NewForm.aspx page. To make it look like a dialog box, you want to add IsDlg=1 to the query string. SharePoint has a built in JavaScript that can do all this for you. Below is an example of a button I created to open new help desk tickets.
//Handle the DialogCallback callback
function DialogCallback(dialogResult, returnValue){}
//Open the Dialog
function OpenNewDialog(){
var options = {
url:"/depts/is/helpdesk/Lists/Service%20Requests/NewForm.aspx?IsDlg=1",
width: 700,
height: 700,
dialogReturnValueCallback: DialogCallback
};
SP.UI.ModalDialog.showModalDialog(options);
}
You can also leave off the width and height options and the dialog window will size itself. For the HTML
<div style="text-align: center">
Open a new Service Request
</div>
How complicated is your query? If the query is only pulling from one list, you could put the filters into a view in the list and replace your query webpart with a List View Web Part (in the browser, select the webpart named after your list). In the List View Web Part properties, switch to your new view. By default, a List View Web Part includes an Add New Item link.
Now, it's a link and not a button. And it's in the footer of the webpart, not at the the top. If you really need a button at the top of the page, you could add a Content Editor Web Part and insert HTML for your own button. You should be able to reuse the Add New Item URL from AllItems.aspx. The URL should look something like this: http://mysite/_layouts/listform.aspx?PageType=8&ListId={21AA3D96-75EE-45CC-A153-D0FA7856DE67}&RootFolder=
Related
I'm building a site in Kentico 12 MVC and working on setting up content personalization. The normal way to do this is to add an editable area in the view:
<div>
#Html.Kentico().EditableArea("area1")
</div>
Then, in the CMS, the Page tab will show an empty area where the user can add a widget with personalized content.
The problem is that the content I want to personalize is located in my site's login box, which is a common element on every page, so I'd need to manually add a widget into the editable area on every page individually. But my site has over 300 pages, so that's totally impractical.
Is there a way from within my view model that I could check if the editable area has any widgets, and if it doesn't, output default content instead? I'm trying to see if there's an API method or something that would let me count the number of widgets inside an editable area, but I can't find anything in the documentation.
I guess you need to check with regex if Editable area html contains widget tag "<object type="widget" >"
I created a list and setup 3 views using "filters" in Sharepoint 2010. On the main wiki page, I created a custom dataview that brought the list into a wiki page and the view was the default view. I have created 3 img buttons and placed them into the datalistview just above the columns in the list so on the wiki page you see the 3 img btns (new, updated, contacts) then the default list view.
What I can't seem to get working (I am not a programmer) is when one of the buttons are clicked, I need the webpart to show the related list view to show on the wiki page, in the webpart. So if I clicked on "New" button, the "new" list view replaces the default view in the webpart. hope this makes sense....
I have been searching for days trying various code that references iframes, and even on this site looked at button click change view questions but none have actually addressed this item that I could tell. Any help would be wonderful!
I have my account entity linked to a custom entity called inspections, I only want these inspections to be created for accounts of a certain type. So when it isn't that type I want the left hand navigation to this entity to be hidden away. I've seen some code that says will hide it away, as long as you have the navID of the item.
I've had a crack at hiding it using what i thought could be the ID but it hasn't worked, so I'm wondering if anyone knows how to get this ID, or if there is another way to do this?
The code I'm using to hide the navigation is below:
var navitem = Xrm.Page.ui.navigation.items.get("nav_ts_inspection");
if (navitem != null)
{
navitem.setVisible(false);
}
Load the form
Press F12 to show IE Developer's Toolbar
From here you can use CTRL+F to search for the display name of the item you'd like to hide. This will give you a link that is generated. The Id of this element is what you need to use to show/hide the link.
As an example, you can see results of searching for 'Sub Accounts' on the Account screen for an installation I am working on at the moment. The Id can be seen and is 'navSubAct'
Changes by traversing DOM and manually hide an area is not officially supported.
Luckily if you are on CRM 2011, you can go to
Settings > Customization Or open the solution.
Select the entity > Forms. Inside the Form editor window, open the Form Properties of the entity.
Go to Display Tab and untick "Show navigation items" checkbox.
Finally do not forget to Publish your changes.
Use the relationshipname to hide folder in navigation like this:
If you have folder with the relationship name: ts_inspection
Use this for ID: navts_inspection
So otherwise the same as above, but lose the extra underscore (_) between nav and ts.
var navitem = Xrm.Page.ui.navigation.items.get("navts_inspection");
If you want to hide particular navigation section from the FORM then remove all the links from that section and publish it. That section will not be visible anymore.
If you want to just remove Navigation Pane from FORM, then go to 'Display' tab of form and mark as 'Do Not Show' and then publish it.
All I am trying to do is to remove the right zone of this site. How do I accomplish this?
Is there any site in SharePoint that doesn't have zones?
Web Part Zones are part of the Page Layout that your page instance is using. To remove a Web Part Zone you can:
Edit the page in SharePoint Designer. Before placing the page into edit mode, SharePoint Designer will ask if you want to detach from the Page Layout. Once you do, you can now format the page however you would like.
Create a custom Page Layout based on the out of the box Page Layout with the right zone removed. After your custom Page Layout is deployed or uploaded, you can associate your page with that layout.
Hide the zone with custom CSS. The easiest way to do this is to add a Content Editor Web Part onto your page with the CSS to hide the zone.
On the content Editor just insert the following and it works:
<script>
function HideWebPartZone()
{
var x = document.getElementsByTagName("TD")
var i=0;
for (i=0;i<x.length;i++)
{
if (x[i].width=="70%")
{
// left column
x[i].style.width="100%";
// center (otherwise empty) column
var x2=x[i].nextSibling;
x2.style.width="0";
x2.style.display="none";
x2.innerHTML="";
// right column
x2=x[i].nextSibling.nextSibling;
x2.style.width="0";
x2.style.display="none";
x2.innerHTML="";
// right margin column
x2=x[i].nextSibling.nextSibling.nextSibling;
x2.style.width="0";
x2.style.display="none";
x2.innerHTML="";
//all done
return;
}
}
}
_spBodyOnLoadFunctionNames.push("HideWebPartZone")
</script>
If you have edit access on the page, you should be able to set the Text Layout to one column to remove that right column. This option is in the Editing Tools->Format Text->Text Layout section of the ribbon when in page editing mode.
once you are in sharepoint designer..please also try right clicking on the aspx file and select "Edit in Advanced Mode" - This will let you delete zones, columns and when you go to save the file you will get prompted to create a custom layout..say Yes...all done in one shot.
I've noticed with Sharepoint 2010, many of the links do not the support open in new tab/window feature. For example, items on the quick menu do not. Is it possible to enable?
Use the JavaScript function to open a new window in SharePoint 2010.
Create the function to open your target window as sample provide below.
function load_url(externallink)
{
window.open(externallink,target='_blank')
}
Place the function load_url in JavaScript file
Click site actions, select manage content and structure.
Suppose you want to change the links in the page
http://someserver/sites/Dev/Help/HelpLinks/AllItems.aspx
Then select the List named HelpLinks in the sub site Help. Dev will be the top most node(site). Help will be a sub site and inside Help you can find List by name HelpLinks.
All the links in the page and their title will be displayed
Select the title of link which you want to open in new tab and right click.
Select Edit properties. Then in the URL field and call the function as javascript:load_url('http://www.google.co.in'); instead of http:// www.google.co.in
Or Else
Suppose you want to change the links in the below URL.
URL: http:// someserver/sites/Dev/Help/HelpLinks/AllItems.aspx
Go To
open to the link http:// someserver/sites/Dev/Help/HelpLinks/AllItems.aspx
You will find the columns of the List (Title Column, URL column, Summary etc).
Select the Title and click Edit property which you want to edit
Then in the URL field and call the function as javascript:load_url('http://www.google.co.in'); instead of http:// www.google.co.in
This answer is a recap of this article and is not an answer I came up with: http://sharepointsolutions.blogspot.com/2007/09/make-selected-links-in-links-list-open.html
Step 1: Add #openinnewwindow to the end of all hyperlinks you want to open in new window.
Step 2: Then you will need to add the follow script to your SharePoint pages.
[script language = "JavaScript"]
//add an entry to the _spBodyOnLoadFunctionNames array
//so that our function will run on the pageLoad event
_spBodyOnLoadFunctionNames.push("rewriteLinks");
function rewriteLinks() {
//create an array to store all the anchor elements in the page
var anchors = document.getElementsByTagName("a");
//loop through the array
for (var x = 0; x < anchors.length; x++) {
//does this anchor element contain #openinnewwindow?
if (anchors[x].outerHTML.indexOf('#openinnewwindow') > 0) {
//store the HTML for this anchor element
oldText = anchors[x].outerHTML;
//rewrite the URL to remove our test text and add a target instead
newText = oldText.replace(/#openinnewwindow/, '" target="_blank');
//write the HTML back to the browser
anchors[x].outerHTML = newText;
}
}
}
[/script]
Whats the 'Quick menu'? Do mean list item context menu or something else? Can you post a screenshot?
There are two types of links used.
Normal HTML anchors - You can hold down the CTRL key when clicking.
JavaScript links (menus and such) the CTRL key doesn't work. If you're working with the Edit/View forms then this may be of interest
SharePoint - Editing The SharePoint List Item Menu
Especially look for Part II where it talks about changing this behaviour in List Settings > Advanced Settings > Dialogs
This is actually an Internet Explorer specific bug. The navigation links in SharePoint 2010 are regular links but have two nested span tags around the text of the link. This confuses IE which doesn't realise that the text you are right-clicking up is a link and so doesn't give the correct context menu. If you right-click just to the left of the text of the link (the cursor should still show as the "hand") the context menu appears as expected.
For Sharepoint 2013, I used Keith's code with a delayed call.
<script type="text/javascript">
// Add an entry to the _spBodyOnLoadFunctionNames array
// so that our function will run on the pageLoad event
_spBodyOnLoadFunctionNames.push("rewriteLinks");
function rewriteLinks() {
$('a').attr("target","_blank");
}
</script>
In the SharePoint Wiki Editor, you can click the "From Address" Link you added, and a LINK menu will appear in the ribbon bar. Inside that, you can click "Open in New Tab" It's not exactly New Window, but it's close and easy.
Add this to the end of the link.
#openinnewwindow
example: http://www.bing.com**#openinnewwindow