Comments (6)
I was looking at adding more Types in my other lib (Slickgrid-Universal) and I did while encountering some problems understanding how to fully add Type for the Column, I wanted to pass the user's data Type as Column<T>
when you define your column definitions and I asked a question about this on Stack Overflow Problem with using a defined TypeScript Generic Type in an external function using the Type T and this Slickgrid-Universal Example is the one that goes with the question. It might not be exactly what you're describing though but it's in the same context. The intention was to pass the data Type to the Column<T>
and it would flow to a few other interfaces like the asyncPostRender
on dataContext: T
.
However note that Aurelia-Slickgrid doesn't have full Type support for these 2 main interfaces of the core SlickGrid and DataView, they were created as SlickGrid and SlickDataView interfaces but they are optional, I added them long after creating the lib and making the lib fully types would break lot of people's code, so I made them as optional and all of my services still refer to grid: any
and dataView: any
. The goal is to eventually remove all the core/common code from Aurelia-Slickgrid (and Angular-Slickgrid) and use Slickgrid-Universal common place (which is fully Typed) and when that happen (in few months), I'll do a major/breaking version of Aurelia-Slickgrid add full Typing.
To be fair I haven't used much of the Column<T>
, it didn't fully work as I wanted (as discussed in the SO) and I only tested with 1 sample, so if you want to change that portion, we could still do it since SlickGrid & DataView are still optional in Aurelia-Slickgrid and barely (if any) are using Slickgrid-Universal and there's no Type in Salesforce (where I use my other lib) because it's ES6 syntax. I don't think anyone knows about the Column<T>
since I didn't advertise it in any demo (apart from Slickgrid-Universal single example).
Again I must say, it's fun to see some people (you) start looking at my code and pinpoint some of my implementation errors hehe
Actually I looked back at my Example and the intellisense does work like I wanted, which is cool and is driven by ... WAIT I was wrong, I added Column<T>
item: ReportItem
and that is where it gets the Type
interface ReportItem {
title: string;
duration: number;
cost: number;
percentComplete: number;
start: Date;
finish: Date;
effortDriven: boolean;
}
/** Custom Formatter */
const customEditableInputFormatter = (row: number, cell: number, value: any, columnDef: Column, item: ReportItem) => {
return item.title;
};
export class Example4 {
columnDefinitions: Column<ReportItem>[];
// ...
}
from aurelia-slickgrid.
Errors is a hefty word. I would say the use cases merely differ ;). The primary need for typesafety for me is on the field property of the column since this gets mapped to a fetched result when populating data and refactoring string based identifiers is a major PITA. The current Column generic was a fun trap since as you pointed out your cast in asyncRenderer did the job.
I can create a PR and you give it a try and decide whether you like and want to merge.
Anyways though I guess your approach to moving the core to universal is certainly a good one and as it stands for now as described initially I have my workaround with a few custom casts so no problem if it doesnt end up being merged.
Edit:
Yes I did look a couple of times at your codebase and I like the simplicity of it. Tbh it was also one of the deciding factors besides the Aurelia interop for your grid control. It makes sure I can modify things as I like and in best case even contribute some of them back, which certainly will be more once our new projects kicks off. I'm still in the prep/analysis phase so going a bit slower since contributions are merely in my spare time.
from aurelia-slickgrid.
I'm totally open to any contributions, since they are so rare I do enjoy them whenever they come. I didn't have good result with Column<T>
, so I'm open to anything that could help improve the lib in any ways.
from aurelia-slickgrid.
You'll gonna like and hate what you see in a couple of minutes :)
from aurelia-slickgrid.
here it is. Its draft on purpose, you'll see why when reading it #442
from aurelia-slickgrid.
closed by PR #466
from aurelia-slickgrid.
Related Issues (20)
- How to configure used namespace (non-default) for i18n translations? HOT 5
- Multiple number column filters of the same type affects only the last column HOT 3
- Some translations are not using namespace prefix HOT 4
- aurelia-cli/systemjs excel export fix HOT 6
- Text Filter is lost of focus when "suppressActiveCellChangeOnEdit = false" HOT 6
- No fixed units in scss variables HOT 10
- Slot for custom footer/header HOT 6
- Error following HOWTO Step by Step guide HOT 3
- formatter HOT 12
- Aurelia-slickgrid breaks other jquery references HOT 2
- Export column width sets on wrong column, when export to excel HOT 12
- 1st (zero) element is not highlited with this.aureliaGrid.gridService.highlightRow(index, delay, delay) HOT 3
- column names are not shown if the slickgrid table is not on the screen HOT 5
- Autosized width overflows parent div in bootstrap 3. HOT 10
- TypeError: Cannot set property dataset of #<HTMLElement> which has only a getter HOT 7
- Customizing GraphQL paging and sorting HOT 3
- Aurelia 2 support HOT 40
- Issues upgrading from v3.12.1 to v4.1.3 HOT 2
- Dependency Dashboard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aurelia-slickgrid.