简体   繁体   中英

Import library jqGrid wih Meteor (NPM)

I perfom a project with Meteor and I would like use free-jqgrid .

But I don't know how I can import this library correctly...

I was try :

  • import 'free-jqgrid';
  • import jqGrid from 'free-jqgrid';
  • import 'free-jqgrid/js/jquery.jqgrid.min';

In my code I use qGrid like this "Getting started" :

angular.element('#grid').jqGrid({
    colModel: [
// ...

And I get this error, on the client : Error: angular.element(...).jqGrid is not a function

Any kind of idea ? :-)

Many thanks.

Sorry, I'm not use Meteor myself. Moreover I use requireJs or SystemJs instead of CommonJS modules. It could be that free-jqgrid has currently some problems in usage as CommonJS module.

Nevertheless I installed Meteor environments and made some tests. As the result I can suggest you the following workaround. You can insert the line

jqGrid(window,$);

directly after

import jqGrid from 'free-jqgrid';

or after

import jqGrid from 'free-jqgrid/js/jquery.jqgrid.src';

if you prefer to use non-minimized source of jqGrid.

You should not forget to import/include jQuery UI CSS or Bootstrap CSS and to import free-jqgrid CSS too:

import 'free-jqgrid/css/ui.jqgrid.min.css';

Additionally you can consider to load jQuery UI CSS, Font Awesome and free jqGrid from CDN . See here and here for more details.

Thanks Oleg.

Meteor package for free-jqGrid

I was fork [meteor-jqGrid] ( https://github.com/free-jqgrid/jqGrid ) package and I adapted this for free-jqgrid. I published this on :

Simply add on Meteor project with the following command into project folder : meteor add aurelienc:free-jqgrid .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM