Posts

Showing posts with the label jQuery

CRUD operation on Users using REST

In the previous post we have seen CRUD operation on SharePoint Folders. In this post we are going to discuss about the operations on users in SharePoint Library using rest api. Starting with the creation of Users class in our"RESTApiHelper" namespace. RESTApiHelper.Users = function (SiteUrl) {     this.SiteUrl = SiteUrl; Get all users in site     this.GetAllUsers = function (doSuccess, doError) {         jQuery.ajax({             url: this.SiteUrl + "/_api/web/SiteUsers",             method: "GET",             headers: {                 "accept": "application/json; odata=verbose"             },   ...

OrgChart Using JQuery and SharePoint List

Image
In this blog post I'm going to display how to build our own Organization chart with the help of JQuery by fetching data from SharePoint List. In this example, I've used the standard jQuery.Orgchart library from this link . Please follow the below steps to generate the Chart: Create a SharePoint List using custom list template and define the hierarchy Create a lookup column of same list. Example, Supervisor column is a lookup of 'Org Chart' list. Now add a content editor webpart on a page. add the jquery references in content editor webpart. <link rel="stylesheet" href="_layouts/jquery.orgchart.css" /> <link rel="stylesheet" href="_layouts/jquery-ui-1.10.3.custom.css" /> <script src="_layouts/jquery-1.9.1.js"/> <script src="_layouts/jquery-ui-1.10.3.custom.js"/> <script src="_layouts/jquery.orgchart.js"/>  Now create a new customorgchart.js file into s...

Selecting all check box in a Table row or column

During one of my assignment I’ve come across a requirement to selecting all the checkboxes in a row or column of table. Accomplishing this task using server side code is really very difficult and need hard coding. So, I’ve come across idea of using jquery. Jquery is really very powerful, and it contains filters and selectors that we can use to select checkboxes. In the process of selecting checkboxes first step is to recognize whether user want to select row or column. So, I tried to get the parent of checkbox i.e. TH or TD. If it’s a TH then selecting column otherwise row. Case 1: Selecting row Selecting row is very simple, by this time you already have instance of TD then by using parent selected we can get the TR of that row.  And once we get TR then selecting checkboxes is piece of cake. Below is the code to select checkboxes. tr.find( 'input[type=checkbox]' ).attr( 'checked' , this .checked); Case 2: Selecting Columns Selecting column is little difficult t...