ĐÀO TẠO DOANH NGHIỆP : SỞ KHOA HỌC CÔNG NGHỆ TỈNH ĐỒNG NAI

ENTERPRISE TRAINING: DONG NAI DEPARTMENT OF SCIENCE AND TECHNOLOGY.

HÌNH ẢNH TẬP HUẤN LỚP SHAREPOINT WORKFLOW VÀ KIẾN TRÚC SHAREPOINT

PHOTOS OF SHAREPOINT WORKFLOW AND ARCHITECTURE CLASS.

HÌNH ẢNH TẬP HUẤN LỚP SHAREPOINT WORKFLOW VÀ KIẾN TRÚC SHAREPOINT

PHOTOS OF SHAREPOINT WORKFLOW AND ARCHITECTURE CLASS.

Showing posts with label Jquery - SPServices - Sharepoint. Show all posts
Showing posts with label Jquery - SPServices - Sharepoint. Show all posts

Tuesday, March 8, 2016

SharePoint 2010 get list items using list.asmx service using Jquery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="/Style%20Library/DownloadDocuments/jquery.SPServices-2014.02.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function popupCenter(title, w, h, url) {
            var url = "/SitePages/Download.aspx?ID=" + url;
            var left = (screen.width / 2) - (w / 2);
            var top = (screen.height / 2) - (h / 2);
            var win = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
            win = null;
            return false;
        }


        function GetSoapQuery() {
            var soapEnv =
                "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                <soapenv:Body> \
                     <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                        <listName>ListOfDownloadDocument</listName> \
                        <viewFields> \
                            <ViewFields> \
                               <FieldRef Name='ID' />\
                               <FieldRef Name='Title' />\
                               <FieldRef Name='LinkToDocument' />\
                               <FieldRef Name='IsShow' />\
                               <FieldRef Name='DisplayOrder' />\
                           </ViewFields> \
                        </viewFields> \
                        <query> \
                         <Query> \
                           <Where> \
                              <Eq> \
                                 <FieldRef Name='IsShow' /> \
                                 <Value Type='Integer'>1</Value> \
                              </Eq> \
                           </Where> \
                           <OrderBy> \
                               <FieldRef Name='DisplayOrder' Ascending='true'/> \
                           </OrderBy> \
                </Query> \
             </query> \
                    </GetListItems> \
                </soapenv:Body> \
            </soapenv:Envelope>";
            return soapEnv;
        }

        $(document).ready(function () {
            var soapEnv = GetSoapQuery();
            $.ajax({
                url: "http://ServerName/_vti_bin/lists.asmx",
                type: "POST",
                dataType: "xml",
                data: soapEnv,
                complete: processResult1,
                contentType: "text/xml; charset=\"utf-8\""
            });
        });


        function processResult1(xData, status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function () {
                var id = $(this).attr("ows_ID");
                /*alert("ID:" + id);*/
                var title = $(this).attr("ows_Title");
                /*alert("Title:" +title);*/
                var linkToDocument = $(this).attr("ows_LinkToDocument");
                var hyperLink = linkToDocument.split(',')[1];
                /*alert("hyperLink:" +hyperLink);*/

                /*$("#download").append('<li><p><a href="javascript:void(0);" onclick="popupCenter(&#39;myPop1&#39;,450,200,&#39;' + hyperLink + '&#39;);">' + title + '</a></p></li>');*/
                $("#download").append('<li><p><a href="javascript:void(0);" onclick="popupCenter(&#39;myPop1&#39;,450,200,' + id + ');">' + title + '</a></p></li>');
            });
        }   
 
    </script>
   
   
    <h1>List of download document</h1>
        <ul id="download">
        </ul>
    </div>

Sunday, December 1, 2013

sharepoint 2010 cascadingdropdown jquery

Download JS and Script at Here
Create custom list with name is Region (Title=>Default)
Create custom list States (Title=> Default, Region => lookup to Regions list)
Create custom list CascadeDemo (Title=> Default, Region => lookup to Regions list, State => lookup to States list)
Note: Should not change internal name of field Region and State (!Important)
Go to list CascadeDemo => list setting >> Advanced Setting >> at Launch forms in a dialog and choose No

Upload 2 jquery libraries to Shared Documents (you can download at here)
At forn NewForm.aspx of CascadeDemo add content editor webpart then click Edit HTML Source follow the image
Input the code like this
<script language="javascript" type="text/javascript" src="/Shared%20Documents/jquery-1.8.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/Shared%20Documents/jquery.SPServices-0.7.2.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
            // Set up the cascade from Region to State
            $().SPServices.SPCascadeDropdowns({
                        listName: "CascadeDemo",
                        relationshipList: "States",
                        relationshipListParentColumn: "Region",
                        relationshipListChildColumn: "Title",
                        relationshipListSortColumn: "Title",
                        parentColumn: "Region",
                        childColumn: "State"
            });
});

</script>
The result as
And
Finish


Friday, March 2, 2012

Article 9: Delete site or subsite


Bạn đang cố gắng xóa một subsite có nhiều subsite trong đó và bạn nhận câu thông báo lỗi : “Error deleting Web site /sites/TestEnvironment/YourSite/. You can’t delete a site that has subsites.” 
Có thể cách của bạn đang làm:
Step 1: Site Actions à  Site Settings
Step 2: Click Sites and workspaces
Step 3:Delete This Site  Delete button

Xuất hiện lỗi : Error deleting Web site “/sites/TestEnvironment/YourSite. You can’t delete a site that has subsites
Bạn có thể thử xóa lại theo cách sau đây:
Di chuyển đến site cha của site muốn delete (trường hợp mình muốn xóa site Job Definitions )
Step 1: Chọn Site Actions à Site Settings
Step 2: Tại tab Site Administrationà chọn Content and Structure
Step 3: Cột bên trái chọn site muốn xóa 
Step 4: Từ Menu Actions  Chọn Delete
Step 5: Câu thông báo trước khi xóa “All subsites in this site will also be permanently lost. Do you want to continue?”, chọn OK
Chúc các bạn thành công


Author: Lê Trung Tín

Article 8: Remove the Quick Launch


Khi làm việc với Masterpages để remove the Quick Launch các bạn làm theo các bước sau:
B1: Start Sharepoint Designer 2010
B2: Chọn Master Pages  Chọn V4.master (File Master Pages cần edit)
B3: Copy đoạn code bên dưới vào phía trên chữ </head>
<style type="text/css">
/*–Hide Quick Launch –*/
#s4-leftpanel{
display:none
}
.s4-ca{
margin-left:0px
}
</style>
Kết quả hiển thị:
Chúc các bạn thành công


Author: Lê Trung Tín

Wednesday, February 29, 2012

Article 7: How to search list item base on ID


1.        Create New list with name is Customer or can download at here
a.       Change field Title to Customer ID
b.      Create new fields:
Name: Single line of text
Address: Single line of text
c.       Create new items as follows:
2.       Open Sharepoint Designer 2010
a.       In Site Pages, create new page ASPX
b.      Name is SearchCustomer.aspx
c.       Design UI as follows:
d.      Code here
<table style="width: 50%">
                <tr>
                                <td>Customer ID:</td>
                                <td>
                                                <input id="txtCustomerID" type="text" />
                                </td>
                </tr>
                <tr>
                                <td>Customer Name:</td>
                                <td>
                                                <input id="txtCustomerName" type="text" /></td>
                </tr>
                <tr>
                                <td>Address:</td>
                                <td>
                                                <input id="txtCustomerAddress" type="text" /></td>
                </tr>
                <tr>
                                <td>&nbsp;</td>
                                <td>
                                                <input id="btnSearch" type="button" value="Search" onclick="SearchCustomer();"/></td>
                </tr>
</table>
e.      Open Sharepoint site

3.       Start code
a.       Download 2 files jquery-1.4.2.js and jquery.SPServices-0.5.6 at here  and upload to Shared Documents on top level site.
b.      Attach 2 files .js to code html above close tag head
  
<script type="text/javascript" src="../Shared Documents/jquery-1.4.2.js"></script>
<script type="text/javascript" src="../Shared Documents/jquery.SPServices-0.5.6.js"></script>
c.       Code here
  
<script type="text/javascript">
var id="#txtCustomerID";
function SearchCustomer() {
            try {
                $().SPServices({
                    operation: "GetListItems",
                                            async: false,
                                            listName: "Customer",
                    CAMLQuery: '<Query><Where><Eq><FieldRef Name="Title" /><Value Type="Text">'+
                    $(id).val()+'</Value></Eq></Where></Query>',
                    completefunc: function(xData, Status) {
                        //alert(xData.responseXML.xml);
                        $(xData.responseXML).find("z\\:row").each(function() {
                                $("#txtCustomerName").val($(this).attr("ows_Name"));
                                $("#txtCustomerAddress").val($(this).attr("ows_Address"));
                        });
                    }
                });
            }
            catch (e) { alert(e); }
        }

</script>
4.       Save file and run on IE => OK
5.       Run on FireFox => OK
6.       Run on FireFox => not OK