Posts

Showing posts with the label Jquery

AngularJS: Export Json object to Excel using AlaSQL

Hello, I have spent significant time developing AngularJS and Angular 2 applications. But this requirement is quite new to me. Well, user wants to export to excel feature on one of our application page where we are using filtered data based upon some parameters. The design decision was on me whether to choose server side function to convert Json object in to CSV format and then export it to excel. But I decided to choose another approach, not to involve server in exporting a Json data. I was not aware about ALASQL but later explored and found its very useful for me to implement this solution. Here I am explaining how to implement it. What you need to import : ALASQL js-xlsx Just an intro about these two libraries: AlaSQL is an open source SQL database for Javascript with a strong focus on query speed and data source flexibility for both relational data and schemaless data. It works in your browser, Node.js, and Cordova. This library is designed for: Fast in-memory SQL data pro...

AngularJS: Bind UI Select selection sequentially

Image
Hello, I felt lucky to work with angularJS with the integration with SharePoint(as backend) in my recent project. There was a requirement to have two drop-downs on a single page application where on selection of one; other drop-down value will be automatically filtered.  I am going to share with you guys that how I have implemented.  I understand that this may not be Ideal way of doing it but I am sure that it is quickest solution that I did in code to achieve this requirement. HTML: The below html will generate two dropdowns and populate with country and states data. <h3>Countries</h3> <ui-select ng-model="ctrl.country.selected" name="country" theme="bootstrap" title="Select a Country" > <ui-select-match placeholder="Select or search a country in the list...">{{$select.selected.name}}</ui-select-match> <ui-select-choices repeat="country in ctrl.countries | filter: $select.search"> <span...

SharePoint CSOM for beginners: Get Current User details

Image
Hi Guys, This blog is targeted to developers who are novice to the client side object model in SharePoint. SharePoint apps by default provides a basic stub for getting user details inside app. But sometimes it is required to add client side code in simple script file to get user information. I hope this information will also be helpful starters of client side object model. Pre-requisites: 1) Any version of SharePoint installed: SP 2013, SP 2010 or SP Online 2) A web application and a root site collection inside it. It does not matter whether site is team site or any other type of site.(Note: In case of publishing site you need to enable sp.js file loading ). 3) SharePoint Designer installed. Step I : Create a custom script file A script file is required in order to place CSOM code to be executed. Well, here depending upon usability user can chooses any one of these two locations to create this file: - List or Style library : It will be hard to update script file if it is placed under s...

JQuery: Get Rid off SharePoint Spell Check

Hi Guys, After spending 3-4 hours of struggle, I finally found way to get rid off irritating SharePoint Spell checker. It caught people picker too under the umbrella of spell check, but why, usually it does not required. Well again it may be the requirement. But for my case, I don't want it to watch any of my control on whole site. I tried to navigate to Manage Farm Features > Spell Check feature. Even after deactivating this feature it still working like a stubborn functionality. Then I realized that nothing is impossible for a developer. I have JQuery with me I can hide that control. Resolution: 1) Hiding spell check from the Ribbon: in order to hide the spell check feature to end user, trick that worked for me is to add following line in my custom js: $('a:has(img[src*="images/spellingHH.png"])').parents("li").hide(); 2) Exclude fields from the spell check feature: I have created follwoing method to exclude people picker and other inputs fields fro...

Jquery: Validate the mobile number field.

Hi, Below is the very simple code which is capable to validate the mobile number field on any .net form. jQuery(document).ready(function () { jQuery("#btnChangeNumber").click(function () { var mobileNo = jQuery("#txtNewMobileNumber").val(); if (mobileNo == "") { alert('Please enter mobile number.'); return false; } else { var rege = /^[0-9\+\-\(\)\s]*$/; if (!rege.test(mobileNo)) { alert('Please enter valid mobile number.'); return false; } } }); }); Enjoy :) !!!!