When you try to create a SharePoint visual webpart that makes use of jQuery, it is generally known that any conflict will cause the javascript rendering to fail, e.g. any document.ready() function.
It is common when you have a lot of customized components that were activated as a feature.
You can easily check whether you have loaded conflicting versions of jQuery from viewing the source on the web page. But how do you control whether or not to load the jQuery if it already exists?
Solution:
Check whether the jQuery object can be created, before loading the .js file using javascript.
if (typeof jQuery == 'undefined') {
var jq = document.createElement('script'); jq.type = 'text/javascript';
// Path to jquery.js file
jq.src = '/_layouts/Test/jquery.min.js';
document.getElementsByTagName('head')[0].appendChild(jq);
}
Wednesday, October 8, 2014
Wednesday, October 1, 2014
躼腳日本料理
This is part of the fun Taiwan travel series. View the full itinerary here.
A part of me was really reluctant to release this post - this had to be one of the best kept secrets in Taipei! And I hope that it remains that way so that it won't be overwhelmed by hordes of tourists, ha ha.
A part of me was really reluctant to release this post - this had to be one of the best kept secrets in Taipei! And I hope that it remains that way so that it won't be overwhelmed by hordes of tourists, ha ha.
Located in the Zhongshan district, the restaurant facade was unassuming enough that passers-by would not give it an extra glance. And yet, the telltale signs of a popular eatery gave it away - before 11:30AM, a long queue was forming up at the entrance.
Tuesday, September 30, 2014
National Palace Museum,Taipei
This is part of the fun Taiwan travel series. View the full itinerary here.
Finally, I have more spare time to continue my notes on my trip to Taiwan.
One of the highlights of my Taiwan trip was (gasp) a visit to the National Palace Museum!
It was said that the best of China artifacts were actually secreted away during the Chinese Civil war - it hosts one of the largest collections of Chinese antiques in the world. Must be the reason why I see a lot of tourists from China.
Finally, I have more spare time to continue my notes on my trip to Taiwan.
One of the highlights of my Taiwan trip was (gasp) a visit to the National Palace Museum!
Tuesday, September 16, 2014
SharePoint powershell to cancel workflows
I got stuck into a situation where the workflows in SharePoint were stuck during the "In Progress" stage, and there was no way to cancel the workflow from the UI.
After googling around, I found a simple powershell solution and adapted it slightly to suit my needs.
The concept is very simple - Load the site, load the library, and either traverse all items, or retrieve a single item based on the ID. For that item, loop through the workflows and cancel it!
After googling around, I found a simple powershell solution and adapted it slightly to suit my needs.
The concept is very simple - Load the site, load the library, and either traverse all items, or retrieve a single item based on the ID. For that item, loop through the workflows and cancel it!
Tuesday, September 9, 2014
Alter schema owner for SQL Server 2008R2 in batches
Recently I encountered a situation where after installing some enterprise software, the schema owners of all tables became something other than dbo. After googling around, here is a quick solution to batch update the owner:
First execute this query in Query Analyzer:
SELECT 'ALTER SCHEMA dbo TRANSFER ' + TABLE_SCHEMA + '.' + TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'toreplace'
Copy the results and run the statements.
Subscribe to:
Posts (Atom)