JSDO Angular-CLI environment?

Posted by Lars Neumeier on 12-Oct-2016 12:54

Hello,

I cannot find any npm package for the JSDO like the angular2-kendo-ui packages. How can I integrate the JSDO in the build step and configure the JSDO as a datasource for the kendo-ui-grid component instead of the http-module?

All Replies

Posted by egarcia on 13-Oct-2016 05:12

Hello,

It would be nice to have these items as enhancement requests via the Ideas section.

We currently do not have an NPM package for the JSDO (there is a pull request for it in GitHub though).

Regarding configuring the JSDO with the Kendo UI Grid with Angular 2, I believe that you can call the JSDO directly and combine an Observable DataGridResult with the JSDO's AfterFill event. I will take a look at this approach.

I hope this helps.

Thank you.

Posted by Mike Fechner on 13-Oct-2016 05:20

Hi Edsel, I'd love to hear how well that goes - any maybe even see a sample :-)

Posted by egarcia on 17-Oct-2016 06:09

Hello Lars, Mike,

I did some research on this.

I was able to call the JSDO directly and create an Observable DataGridResult object from a Promise object.

The Promise object uses the JSDO's AfterFill event with subscribe/unsubscribe.

Please find a sample program for this in the Documents section:

   community.progress.com/.../3124

The sample program includes usage of the count operation to handle paging.

The program can be enhanced to support filtering as well. (However, I have not tested that yet.)

The program can be enhanced to use the JSDOSession object instead of the Session.

Please let me know if you find it useful.

Enjoy,

Edsel

Posted by Mike Fechner on 17-Oct-2016 21:28

Lovely!
 
I’ve had to run this here first and login with my Telerik account:
 
npm login --registry=registry.npm.telerik.com/ --scope=@progress         
 

Posted by Lars Neumeier on 21-Oct-2016 05:47

Thank you Edsel.

I created a package.json file and put the jsdo js and typescript definition file in the node_modules folder (simulating a npm module).

package.json:

{
  "name": "@progress/jsdo",
  "version": "4.3.0",
  "description": "Progress JSDO",
  "main": "dist/npm/js/progress.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "JSDO", "CDO", "Datasource", "Kendo UI"
  ],
  "author": "Progress Software Corporation http://www.progress.com",
  "license": "Apache-2.0",
  "homepage": "github.com/.../JSDO,
  "repository": {
    "type": "git",
    "url": "git+github.com/.../JSDO.git"
  },
  "typings": "dist/npm/js/progress",
  "bugs": {
    "url": "github.com/.../issues"
  }
} 

Angular CLI Struktur:
node_modules\@progress\jsdo\package.json
node_modules\@progress\jsdo\dist\npm\js\progress.js
node_modules\@progress\jsdo\dist\npm\js\progress.d.ts


Using in app.component.ts:
import { progress } from '@progress/jsdo';

export class AppComponent {

  someMethod(): void {
      let session = new progress.data.Session();
  }

}

In package.json from the Angular-CLI project:
"dependencies": {
    "@angular/common": "~2.0.0",
    "@angular/compiler": "~2.0.0",
    "@angular/core": "~2.0.0",
    "@angular/forms": "~2.0.0",
    "@angular/http": "~2.0.0",
    "@angular/platform-browser": "~2.0.0",
    "@angular/platform-browser-dynamic": "~2.0.0",
    "@angular/router": "~3.0.0",
    "@progress/kendo-angular-buttons": "^0.10.3",
    "@progress/kendo-angular-grid": "^0.3.3",
    "@progress/kendo-angular-inputs": "^0.11.0",
    "@progress/jsdo": "^4.3.0",
    "core-js": "^2.4.1",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },

I think, that this configuration can be used to create a npm module.

Kind regards,

Lars Neumeier

Posted by egarcia on 21-Oct-2016 07:17

Hello Lars,

Many thanks for sharing this.

I will check it out and use it for when we need to create an NPM module.

Best regards,

Edsel

Posted by Lars Neumeier on 12-Nov-2016 05:06

Hello Edsel,

I forked the JSDO repository, created a npm module and included an updated typescript definition from you. I hope that's okay.

github.com/.../JSDO

NPM Package:

www.npmjs.com/.../jsdo

Posted by egarcia on 12-Nov-2016 06:35

Thank you Lars.

we should eventually merge these changes into the the main branch.

Thanks again,

Edsel

Posted by Mike Fechner on 12-Nov-2016 06:46

+1

This thread is closed