aurelia-v-grid / vGrid

Aurelia-v-grid - npm source
MIT License
49 stars 10 forks source link

Fetching data from grid.... Anyone? I'm a hurry with these! #75

Closed JOKaija closed 7 years ago

JOKaija commented 7 years ago

Can't get filtered rows anymore. v-grid vs. vGrid

this.appState.filtered = this.myGrid.ctx.vGridCollectionFiltered;

SOLVED!

this.appState.filtered = this.gridConnector.datasource.collection.entities;

Can't get clicked row data anymore from onClick event. v-grid vs. vGrid

singleClick(data)
{
    this.gotoReclamation(data.data.Id);
}

SOLVED!

this.gridConnector.datasource.entity.Id;

JOKaija commented 7 years ago

....and can't get these either....

collectionEvent(e){
    this.collectionLength = e.totalLength;
    this.filteredLength = e.filterLength;
    this.selectionLength = e.selectionLength;
    var rows= this.myGrid.ctx.vGridCollectionFiltered;
}

SOLVED. Partly.

Data can be fetched from here:

    this.collectionLength = this.gridConnector.datasource.mainArray.length;
    this.filteredLength = this.gridConnector.datasource.collection.entities.length;

but collectionEvent never raised.

vegarringdal commented 7 years ago

Atm I dont have collection event, need to add that to the datasource, since the grid code does not have the data anyone, datasource go it

The click event "v-row-onclick" should work, need to add it to the docs v-row-onclick.delegate="singleClick($event.detail)"

If it does work, Ill have a look at it later today and fix it

JOKaija commented 7 years ago

Thank you!

click event work just fine (data = null), so, I collect data directly from datasource. No problem.

Btw, how I can set cells to readonly? Adding the parameter to CSS? -> Update problem...

Btw, this start to look very promising now! Thanks goes to you! paypal account?

vegarringdal commented 7 years ago

Fixing the rowClick so its adding data now, also doing minor update to docs (will need more work) Rowclick also gets the binding context, please dont use this yet for anything, might break something

vegarringdal commented 7 years ago

Btw, this start to look very promising now! Thanks goes to you!

the grid still needs some work, but I want to fix this one, the old one it was to easy to break stuff 😂

Pushed out the fix/new build for the click with data. (hint: package json gets new version number everytime I do new build, so with that one you can check if you are on the newest version, not doing releases before more is 100% tested, fixed)

vegarringdal commented 7 years ago

New build Here is how you can listen and get collection status now

When you create the ds, add a event listener to it

this.ds = new DataSource(new Selection('multiple'));
this.dsEventID = this.ds.addEventListener(this.dsEvents.bind(this));

In you event listner use the getCollectionStatus() on datasource Please dont make logic from event you get on the datasource eventlistenes, because I dont know if Im changing names, and Ill only end up breaking your app

public dsEvents(e) {
    console.log(e)
    console.log(this.ds.getCollectionStatus());
    return true;
  }

This will give you

{collectionLength: 5000, filteredCollectionLength: 5000, selectionLength: 4}
JOKaija commented 7 years ago

Great! \o/