Thursday, November 26, 2020

Datatables - Keeping selected page number after callback

I save the DataTable state in the local storage to avoid passing the page number all over my app. This is how I do it:
This is very useful when you go to another page and you want to go back (using the back button) to the last selected page.
reference

Tuesday, October 6, 2020

Sort JSON Array with Value

Example:Sort JSON Array

Thursday, September 10, 2020

Selecting distinct values from a JSON

 

eData is the JSON array

var items = eData.map((d)=> {return d.year})

var uniq = items.filter(GetUnique)


function GetUnique(value, index, self) { 
    return self.indexOf(value) === index;
}

Thursday, August 6, 2020

Replacing SharePoint Designer with VS Code

“Replacing SharePoint Designer with VS Code”

- install VS Code
- Add extension SPGO to your VS Code
- Execute following 2 thing
------ Connect to workspace
Press F1 : write > SPGO Configuration Workspace
put the URL and some relevant default inputs

-- new SPGO.json file will be created something like:

{
  "sourceDirectory": "src",
  "sharePointSiteUrl": "https://domain.sharepoint.com/itBudget",
  "workspaceRoot": "f:\\SPApps\\itBudget",
  "publishWorkspaceOptions": {
    "destinationFolder": "/",
    "globPattern": "f:\\SPApps\\itBudget\\src\\**\\*.*",
    "localRoot": "f:\\SPApps\\itBudget\\src"
  },
  "publishingScope": "SaveOnly",
  "authenticationType": "Digest",
  "remoteFolders": ["/SiteAssets/Custom/js", "/Pages", "/SitePages"]
}

In case if SiteAssets folder is not getting downloaded, try to add the pattern "/SiteAssets/**/*"

Press F1 again: write > SPGO Populate local workspace
enter : registered EMail and Password.

Source found at following URLs

Wednesday, August 5, 2020

Unable to open SharePoint Designer Site



Unable to open SharePoint Designer Site

Remove all the content from following folders to avoid issue
  • %APPDATA%\Roaming\Microsoft\Web Server Extensions\Cache
  • %APPDATA%\Microsoft\Web Server Extensions\Cache
  • %APPDATA%\Microsoft\SharePoint Designer\ProxyAssemblyCache
  • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
  • %APPDATA%\Microsoft\SharePoint Designer

Monday, July 27, 2020

Create QR-Code with VBA

Function to add QR-Code as image in your file.


Function Insert_QR(codetext As String)
	Dim URL As String, MyCell As Range

	Set MyCell = Application.Caller
	URL = "https://chart.googleapis.com/chart?chs=125x125&cht=qr&chl=" & codetext
	On Error Resume Next
	  ActiveSheet.Pictures("My_QR_" & MyCell.Address(False, False)).Delete 'delete if there is prevoius one
	On Error GoTo 0
	ActiveSheet.Pictures.Insert(URL).Select
	With Selection.ShapeRange(1)
	 .PictureFormat.CropLeft = 10
	 .PictureFormat.CropRight = 10
	 .PictureFormat.CropTop = 10
	 .PictureFormat.CropBottom = 10
	 .Name = "My_QR_" & MyCell.Address(False, False)
	 .Left = MyCell.Left + 25
	 .Top = MyCell.Top + 5
	End With
	Insert_QR = "" ' or some text to be displayed behind code
End Function


Excel To PDF with VBA

 

Sub ConvertExcelToPDF()
'Export Single Sheets
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="TrainingDeo",      OpenAfterPublish:=True

'Export Multiple Sheets
Sheets(Array("RemovingDuplicates", "HideUnhide", "ExportToPDF")).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="TrainingDemo2", OpenAfterPublish:=True

Sheets("ExportToPDF").Select
Range("A1").Select
End Sub


Reference Code at YouTube