Not at the moment, but we are adding one in the next site update. Will comment here when it's deployed.

By on 3/24/2015 7:22 AM ()

This is my code, but it doesn't work. What am I missing?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[<JavaScript>]
[<Require(typeof<WebSharper.Highcharts.Resources.Highcharts>)>]
[<Require(typeof<WebSharper.SlickGrid.Resources.Core>)>]
[<Require(typeof<WebSharper.SlickGrid.Resources.Css>)>]
module Client =
    open WebSharper.JQuery

    type StrategyPerformance =
        {
            StrategyName : string
            RebalanceDate : string
            ClosePL : float
            DailyReturn : float   // by percentage
        }
    
    let Start input k =
        async {
            let! data = Remoting.Process(input)
            return k data
        }
        |> Async.Start

    let Main () =
        let dm = Div []
        let data = [|
                        { StrategyName = "A1"; RebalanceDate="fEB"; ClosePL=100.; DailyReturn=0.02 }
                        { StrategyName = "A2"; RebalanceDate="fEB"; ClosePL=100.; DailyReturn=0.02 }
                    |]
        let cols = [|
                        new Slick.Column<StrategyPerformance>("x1", "StrategyName")
                        new Slick.Column<StrategyPerformance>("x2", "RebalanceDate")
                        new Slick.Column<StrategyPerformance>("x3", "ClosePL")
                        new Slick.Column<StrategyPerformance>("x4", "DailyReturn")
                    |]
        let grid = new Slick.Grid<StrategyPerformance>(dm.Dom, data, cols)
        dm
By on 3/24/2015 7:53 AM ()

Also, note that [<Require>] annotations are no longer necessary with the latest SlickGrid extension.

By on 3/27/2015 8:17 PM ()

How to use getItemMetaData in slick grid data view, i tried code below, but it doesn't work

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if is_update_price then
     let! last_perf = Remoting.GetStrategyPerformance()
     last_perf
     |> Seq.iteri (fun i x ->
     if is_update_graph then
     let h = (DataStateStrategy.Item x.StrategyID).IntraDayData2
     h.Add({Time = DateTime.Now; Price =  x.ClosePL})
     )
     strat_view.BeginUpdate()
     strat_view.SetItems(last_perf)
     strat_view.Refresh()
     strat_view.GetItemMetadata(0).CssClasses <- "highlight-row"
     strat_grid.Render()
     strat_view.EndUpdate()
                       
By on 4/15/2015 1:02 AM ()

For one, since you are in a BeginUpdate() EndUpdate() block you still have no items probably, so GetItemMetadata(0) will yield null. The CssClasses field is not modifyable anyway so you can't change it that way.

This is the corresponding code in SlickGrid:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function getGroupRowMetadata(item) {
  return {
    selectable: false,
    focusable: options.groupFocusable,
    cssClasses: options.groupCssClass,
    columns: {
      0: {
        colspan: "*",
        formatter: options.groupFormatter,
        editor: null
      }
    }
  };
}

This will always return a new object so it doesn't matter what you change the cssClasses field to. I'm really no expert on SlickGrid so I have no idea how to do what you are trying to accomplish but this is surely not gonna work. Look around on their site for samples. It should not be hard to translate those to WebSharper (except for when they abuse JavaScript features that are hard to do in a statically typed language).

By on 4/17/2015 1:54 AM ()

Try specifying for each column which field belongs to it, like so:

1
new Slick.Column<StrategyPerformance>("x1", "StrategyName", Field = "StrategyName")

because StrategyPerformance will be compiled into a JS object that has its corresponding field named StrategyName.

By on 3/24/2015 6:28 PM ()

still not work may you give me workable sample

By on 3/25/2015 6:17 AM ()

We just added a basic and a slightly more advanced sample. Check them out! Also don't forget to update your extension as we rolled out some bugfixes.

By on 3/27/2015 4:26 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper