Three questions about WebGrid

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Three questions about WebGrid

Herbert König
Hi,

seems I can't solve two things about WebGrid.

1- how do I make a WebGrid column unsortable? In my case the
underlying collection is a sorted collection which is not user
sortable.

2- I stumbled over WebGrid>>rowGreenIfTrue: and friends and I like it
a lot. If a column contains a link (added via >>addBlock) the #bold
argument is ignored. Minor aesthetic issue.

And while I'm at it:
To make the row above the Grid display the selected row in the grid, I
did:
column: 3
      addBlock:
          [:each |
          WebElement new
            addLinkTo: self observee
            text: each positionsText
            view: aViewSymbol     "This is in a reusable component"
            parameter: 'Selected'
            value: each idString].

and in every view I use this component I call:

selectedIdFromView
  | selPos selectedId |
  selectedId := self session lastRequest queryAt: 'Selected'.
  selPos := self observee abrechnung positionen
              detect: [:each | each idString = selectedId]
              ifNone: [nil].
  selPos ifNotNil: [self observee selectedPosition: selPos]

And I had to implement idString on the model solely for this purpose.

Is there a way to do this with less code?

Ideally I would like:
column: 3
      addBlock:
          [:each |
          WebElement new
            addText: each positionsText;
            onClick: [self observee selectedPosition: each.
            "now automagically update the line above the Grid
            with one more line of code"]].

Oops, maybe this is too much to expect?
But I feel I wrote a lot of code to achieve my end. Hopefully this is
mainly a lack of knowledge on my side.

Btw, the capitalised text in the picture is not my idea :-))


Thanks,

Herbert                          mailto:[hidden email]
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

columns.PNG (17K) Download Attachment