dotnet-websharper / slickgrid

SlickGrid for WebSharper
https://websharper.com
0 stars 1 forks source link

System.NotImplementedException when constructing Slick.Column #1

Open mpblackman opened 3 months ago

mpblackman commented 3 months ago

Hello..trying this out in a multipage Websharper app using the code from Try Websharper - Slickgrid, and getting: System.NotImplementedException: The method or operation is not implemented. at WebSharper.SlickGrid.Slick.Column 1..ctor(String id, String name)

This is line 84 let columns = in the TryWebsharper - slickgrid source. I'm using Websharper 4.7.3.446 and similar versions for the other WS dependencies.

Another issue that gives me pause is under the module Advanced grid, open Websharper.JQuery - I notice that this package requires Websharper 5.0 and up, whereas SlickGrid package requires Websharper 4.7 to 4.8

granicz commented 3 months ago

If you are using WebSharper 4.x, you need to target .NET 4.x and you need F# 4 - all in all, an unlikely combination at this day and age. I'd recommend moving to WebSharper 8 beta, but then SlickGrid needs to be pulled up to match it and likely needs a full re-binding. Can you help with that?

mpblackman commented 3 months ago

Thanks for the reply. I'm not sure I have the capability as I'm not a professional developer. Maybe if you show me how to start it off I could continue from there. Another thing occurs to me; you have blogged about incorporating Fable libraries. Which do you think would be easier - incorporating Feliz-Ag-grid into WebSharper or re-binding Slickgrid?

granicz commented 3 months ago

Re-binding SlickGrid would certainly be more concrete, I wouldn't want to depend on several layers of libraries (Feliz -> WebSharper.Feliz -> Faliz-Ag-grid, etc.) just to save a relatively small effort.

mpblackman commented 3 months ago

OK. On a quick look at slickgrid, I could start by matching up types between slickgrid.core.ts and WS.slickgrid and adding or commenting out some as required. Beyond that I may need some help.

granicz commented 3 months ago

You can take any of the current "core stack" bindings ( = available for the latest version of WebSharper), such as https://github.com/dotnet-websharper/threejs/tree/net8upgrade as a base.

mpblackman commented 3 months ago

OK, I will clone the threejs base as a starter. I probably won't get it fully working but I can do my first pass and submit as draft pull request to a new branch or just email to you?

granicz commented 3 months ago

PR would be great, thanks!

mpblackman commented 3 months ago

I am getting somewhere but feel like I have fallen in the deep end at the Olympic diving pool :) I have some questions please:

  1. do you keep all the ts files in one folder (to avoid path references), rather than using subfolders for plugins, models etc as per the slickgrid.ts library)

2a. we have several examples such as Pattern.Config "Slick.Column", which generate a Class called "Slick.Column" whereas the typescript has an Interface called "Column" (from models/column.interface.ts). Should the WS naming match exactly, ie should it be Pattern.Config "Column"? 2b. and is it OK that it generates a Class rather than an Interface? Sometimes the typescript exports a Class and sometimes it exports an Interface.

  1. If the typescript interface returns 'any', what type should WS treat this as? is it type-safe?
Jooseppi12 commented 3 months ago

1 - We don't need to store the ts files in the repo, as we are aiming to be based on the npm package, so you would need something like this:

<PropertyGroup>
    <NpmDependencies>
      <NpmPackage Name="three" Version="gt= 0.165.0 lt 1.0.0" ResolutionStrategy="Max" />
    </NpmDependencies>
  </PropertyGroup>

in the project file. Then with the help of femto this could be installed into your packages.json on the client project side. In the code you would annotate classes with the Import or ImportDefault functions, telling for a given code piece to where it's getting imported, just like how you would do that in TS.

I know we currently have the js files in there, but it's a really old binding at this point and we are gravitating toward npm based dependencies. Just to give context, the binding is based on this repo: https://github.com/mleibman/slickgrid, which has not been updated for 8 years at this point. The current one should be based on the https://github.com/6pac/SlickGrid repo, as that is the most active fork and luckily for us, they also release npm packages: https://www.npmjs.com/package/slickgrid

2a - For Pattern.Config's generally you don't care about exact matches, the name given there is more for the F# side of things. 2b - Yeah, that should be fine

3 - Well, if it's dynamic what it returns with that any, I would not bother much about it, you could just bind it to an object and then in the code you can match on the shape or just use the ? operator to access fields dynamically from the object, like myObj?value. Also it really depends on the use case, how much you need to interact with that object for example.

mpblackman commented 3 months ago

Thanks, OK I have found Import now in the pre-release version of WebSharper

mpblackman commented 2 months ago

I have gone about as far as I can with this. Have generally updated and added items in line with latest SlickGrid and Websharper 7 beta, but to be honest this work is outside my zone of competency. The best I can say is there are no red squiggles ;) I'd like to push something up but I believe I need to be granted membership to the repository please.

granicz commented 2 months ago

Please submit a PR instead, this will add you as a contributor once the PR is merged in. Thanks!

mpblackman commented 2 months ago

Forgive me if I'm wrong, but to do a pull request I first need to push a branch to the repository, for which access is denied. For now I have uploaded it to my public repository here

Jooseppi12 commented 2 months ago

@mpblackman That's not the only option you have. You can create a fork from which you can submit a PR through. This way you can contribute to open source repos, without the owners having to grant permissions to the repository.