0

I'm trying to migrate jQuery Datatable from On Prem 2013 to online, I'm gonna create SPFX application extension, where I insert the scripts in order, still datatable is undefined.

$.fn.dataTable is undefined

I'm using jQuery 1.11.1 and DataTables 1.10.4.

Loading jquery and other files like below in config.json

 "externals": {
    "jquery": "https://xxx.sharepoint.com/SiteAssets/FileLookup/jquery-1.11.1.min.js",
    "datatables.net" : {
      "path": "https://xxx.sharepoint.com/SiteAssets/FileLookup/jquery.dataTables.min.js",
      "globalName": "jQuery",
      "globalDependencies": [
        "jquery"
      ]
    },
    "propertysearch": {
      "path": "https://xx.sharepoint.com/SiteAssets/FileLookup/filesearch.js",
      "globalName": "propertySearch",
      "globalDependencies": [
        "jquery",
        "datatables.net"
      ]
    }
  },

Shed me some ideas

1 Answer 1

0

Make sure you are using proper import statements & $ variable initialization like:

import 'jquery';
import 'datatables.net';
import 'moment';

And

var $: any = (window as any).$;

Follow this step by step guide which is exactly similar to your requirements: Migrate jQuery and DataTables solution built using Script Editor web part to SharePoint Framework

1
  • let me check this, the thing is I'm not trying to replicate existing code in SPFx, I'm trying to reference existing JS file scripted for data table implementation Commented Aug 17, 2021 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.