Web Service Nodes Request Sample
This sample requests node data from a SharePoint Site with jQuery and displays it as a simple UL LI structure on this page. The function JNodes of the Web Service is called with the option for JSONP (cross domain), the ID of the configuration, the optional request-URL and configuration object.

Code of this sample
Line 3: The url of the Web Service
Line 6: The id of the configuration
Line 8: The url the current request belongs to (defines "This Site", "This Web" in configuration)
Line 12: A optional configuration object (sets/changes the configuration for the current request)
$(function() {
    $.ajax( {
        url: 'http://sharepoint2010test.getyournet.ch/_vti_bin/modulerix/TreeViewService.svc/JNodes?callback=?', // ?callback=? for JSONP | ?mode=json for JSON
        dataType: 'json',
        data: {
            id: 'g_30f577a0_2aac_4edf_8110_438997627c99',
            node: '0',
            cururl: 'http://sharepoint2010test.getyournet.ch',
            filterselect: false,
            startindex: 0,
            maxitems: -1,
            config: JSON.stringify({"Context":"0","Mode":"2","ShowCollectionURL":false,"ShowCollectionURLApp":false,"RootCollection":"0","RootWeb":"1","ShowTopWeb":false,"RootList":"0","RootListName":"","ShowTopList":true,"ViewName":"Testview für Tree","RenderMode":1,"Integration":1,"TopNode":"","TopNodeDescription":"This is a sample of the modulerix Navigation Web Part as a tree view control. Press Shift and click to open targets in a new window. Sort nodes with drag and drop.","TopNodeClosed":false,"MaxDataBindDepth":-1,"ExpandDepth":0,"NodeIndent":36,"OpenWindow":1,"LinkFileOnly":true,"ClickOpenOnly":false,"ClientSideSelect":true,"ClientSideSelectPath":false,"HoverOpen":false,"CloseOnOpen":true,"MenuAutoOpen":true,"MenuAutoClose":true,"MenuAutoCloseNotSelected":false,"MenuAutoCloseNotSelectedReselect":false,"MenuInstanceClose":true,"MenuSelectFirst":false,"MenuSetContentHeight":false,"OpenWindowName":"","SortAllAlpha":false,"AutoExpandToWeb":false,"ExpandSelected":false,"HideUpper":false,"HideSame":false,"ShowLines":false,"ShowIcons":true,"ShowIconsLevel":0,"ShowIconsLevelDownUp":0,"ShowIconsWeb":true,"ShowIconsDoc":true,"LargeIcons":false,"ShowWebTitle":false,"ShowHTML":true,"ShowDescription":true,"ShowFileAsItem":true,"ShowFolderAsItem":true,"PopupToolbar":false,"HideToolbar":false,"NoAjaxLoader":false,"ShowListChildren":true,"ShowListLevel":0,"ShowListLevelDownUp":0,"ShowItemChildren":true,"ShowWebChildren":true,"ShowWebLevel":0,"ShowWebLevelDownUp":0,"ShowDocLibChildren":true,"ShowDocLevel":0,"ShowDocLevelDownUp":0,"ShowFileChildren":true,"ShowFolderChildren":true,"HideEmptyFolders":false,"ShowGlobalNav":false,"ShowGlobalNavLevel":0,"ShowGlobalNavDownUp":0,"ShowQuickNav":false,"ShowQuickNavLevel":0,"ShowQuickNavDownUp":0,"ExcludeFilter":"","ExcludeFilterURL":"","StateSave":0,"StateReadonly":false,"FilterSave":0,"FilterReadonly":false,"SortSave":0,"SortReadonly":false,"DisableDefaultStyles":false,"DisableSharePointStyles":false,"StylesOuterArea":".modulerixTV a { color: #888 !important; \nfont-size: 13px; font-weight: normal; font-family: Arial; }\n\n.modulerixTV .toproot-png { background-image: url(/_layouts/images/sharepointfoundation16.png) !important;  }\n","ElevatedView":false,"AllowConfig":1,"AllowFilter":3,"AllowSort":3,"FilterValue":30})
        },
        success: function(data) {
            AddNodes(data, $('#content').empty());
        }
    });
});
function AddNodes(data, tonode) {
    var a = $('<ul>');
    $.each(data, function(index, value) {
        var b = $('<li>');
        b.attr('id', value.A);
        var c = $('<a target="_blank">');
        c.html(value.B);
        c.attr('href', value.C);
        if(value.I)
            c.attr('title', value.I);
        b.append(c);
        a.append(b);
        if(value.H)
            AddNodes(value.H, b); 
    });
    tonode.append(a);
}
</script>
<div id="content" class="samplelist"><img src="images/loader7.gif" /></div>
Write a Comment
comments powered by Disqus