问题
In my current project we have been using jqGrid in almost every page. We use the grid's full rich featureset including complex grid inline row editing, with drop down, check box and other controls, sorting, column filtering and more.
Now we wish to convert our project into angular 2, but our main problem is replacing jqGrid's rich featureset. Before starting I need to do some POC if all the functionalities can be done in angular 2 based grid.
How can jqGrid be used in Angular 2+?
回答1:
You don't wrote which version of jqGrid you use and from which fork of jqGrid. The development is spitted after version 4.7. There are now two main forks: free jqGrid, which I develop, and commercial Guriddo jqGrid JS.
I find the wrong way to rewrite all existing components on changing of the JavaScript framework, which you use. Every framework modify finally the HTML page via DOM. Every modern JavaScript frameworks support of binding/mounting foreign component, which manipulate DOM internally. It's directive
/directives
in Angular 1/2, componentDidMount
in React, mounted in vue.js and so on. As the result you get Angular 2 components, which have the required functionality. Following the way you can reduce the development time and to use the best components existing on the markt. The end user, which uses your web site will see no difference between native Angular components and the mount JavaScript components.
Another aspect of integration of components in Angular 2 is TypeScript. It's nice language, which provide much better control of datatypes and parameters as JavaScript can. The problem can be solved by providing *.d.ts
files with type definitions for JavaScript components. Free jqGrid 4.14.0 includes free-jqgrid.d.ts, which describes all existing jqGrid options, callbacks and events. Using the corresponding text editor like Visual Studio Code you will get advantage of IntelliSense. As the result you'll improve productivity and quality of the code holding many parts of your existing code.
回答2:
I think ag-grid will be a right choice for Angular2 and React js type of applications, Because they have all the above described features as well as some new exciting features as Floating column ,Grouping column ,pivoting ..bla bla etc.
来源:https://stackoverflow.com/questions/43465941/how-to-utilize-jqgrid-in-angular-2