JQGrid Events

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

JQGrid Events

Robert Sirois
How do I add an event to my grid?

There's a list here: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events.

There doesn't seem to be an easy way to associate a callback with a cell / row like WATableReport.

RS

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JQGrid Events

mmimica
You have to expand the Smalltalk side of JQgrid with events you want
to use. It's not much work.
For example, I have added this to JQgrid class for 'gridComplete' event:
gridComplete: aFunction
        self optionAt: 'gridComplete' put: aFunction

Then you call:
html table
    script: ((html jQuery this grid)
            ...
            gridComplete: 'var blah; ... ' asFunction;
            ...
        ).


On 3 September 2011 05:11, Robert Sirois <[hidden email]> wrote:

> How do I add an event to my grid?
> There's a list
> here: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events.
> There doesn't seem to be an easy way to associate a callback with a cell /
> row like WATableReport.
> RS
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>



--
Milan Mimica
http://sparklet.sf.net
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: JQGrid Events

Robert Sirois
Thanks Milan. I don't completely understand the javascript patterns... or javascript for that matter ;)

What I ended up doing is this:

data do: [:t |
html document addLoadScript: ((html jQuery: t title asSymbol) live: 'click' do: ((html jQuery ajax callback: [ ... ]) onComplete: html javascript refresh)).
].

It's a little ridiculous, but oh well. I'm going to try and figure out the tree addon at some point.

Thanks,
RS

> Date: Wed, 7 Sep 2011 22:09:54 +0200

> Subject: Re: [Seaside] JQGrid Events
> From: [hidden email]
> To: [hidden email]
>
> You have to expand the Smalltalk side of JQgrid with events you want
> to use. It's not much work.
> For example, I have added this to JQgrid class for 'gridComplete' event:
> gridComplete: aFunction
> self optionAt: 'gridComplete' put: aFunction
>
> Then you call:
> html table
> script: ((html jQuery this grid)
> ...
> gridComplete: 'var blah; ... ' asFunction;
> ...
> ).
>
>
> On 3 September 2011 05:11, Robert Sirois <[hidden email]> wrote:
> > How do I add an event to my grid?
> > There's a list
> > here: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events.
> > There doesn't seem to be an easy way to associate a callback with a cell /
> > row like WATableReport.
> > RS
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
>
>
>
> --
> Milan Mimica
> http://sparklet.sf.net
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JQGrid Events

Sabine Manaa
In reply to this post by mmimica
Hi,

I put my model objects in a JQGrid.
I want to add the onCellSelect: callback (>>http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events).

I added:

JQGrid>>onCellSelect: aFunction
        self optionAt: 'onCellSelect' put: aFunction


now, with:

(html jQuery this grid
        gridComplete: 'alert(''Bing'')' asFunction;...


I get an alert when clicking at the cell.

But I dont know how to get the selected model instance within smalltalk (for further editing).
Can anyone help?
Reply | Threaded
Open this post in threaded view
|

Re: JQGrid Events

Paul DeBruicker
Hi -

I did something like that in the FullCalendar-Dev-Example package in
JQueryWidgetBox repo on squeaksource.  See the send of #onEventClick: in
JQFullCalendarExampleCalendar>>#renderCalendar: . Also the
implementation of JQFullCalendar>>#onEventClick: may help.

It opens a JQDialog and loads content about that calendar event from
Pharo into the dialog on the client.

In your case you probably want:
#onCellSelect:
self optionAt:'onCellSelect' put: (aCallback asFunction: #('rowId'
'iCol' 'cellcontent' 'e'))




Let me know if thats not what you had in mind.


Good luck

Paul





On 09/14/2012 07:04 AM, Sabine Knöfel wrote:

> Hi,
>
> I put my model objects in a JQGrid.
> I want to add the onCellSelect: callback
> (>>http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events).
>
> I added:
>
> /JQGrid>>onCellSelect: aFunction
> self optionAt: 'onCellSelect' put: aFunction/
>
> now, with:
>
> /(html jQuery this grid
> gridComplete: 'alert(''Bing'')' asFunction;.../
>
> I get an alert when clicking at the cell.
>
> But I dont know how to get the selected model instance within smalltalk (for
> further editing).
> Can anyone help?
>
>
>
> --
> View this message in context: http://forum.world.st/JQGrid-Events-tp3787423p4647456.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JQGrid Events

xx397
And then if memory serves you would call it with something like html
jQuery this grid onCellSelect: (html jQuery ajax callback: [:val | rowId
= val ] value: (JSStream on: 'rowId'); callback: [:val | iCol = val ]
value: (JSStream on: 'iCol')); etc

> Hi -
>
> I did something like that in the FullCalendar-Dev-Example package in
> JQueryWidgetBox repo on squeaksource.  See the send of #onEventClick:
> in JQFullCalendarExampleCalendar>>#renderCalendar: . Also the
> implementation of JQFullCalendar>>#onEventClick: may help.
>
> It opens a JQDialog and loads content about that calendar event from
> Pharo into the dialog on the client.
>
> In your case you probably want:
> #onCellSelect:
> self optionAt:'onCellSelect' put: (aCallback asFunction: #('rowId'
> 'iCol' 'cellcontent' 'e'))
>
>
>
>
> Let me know if thats not what you had in mind.
>
>
> Good luck
>
> Paul
>
>
>
>
>
> On 09/14/2012 07:04 AM, Sabine Knöfel wrote:
>> Hi,
>>
>> I put my model objects in a JQGrid.
>> I want to add the onCellSelect: callback
>> (>>http://www.trirand.com/jqgridwiki/doku.php?id=wiki:events).
>>
>> I added:
>>
>> /JQGrid>>onCellSelect: aFunction
>>     self optionAt: 'onCellSelect' put: aFunction/
>>
>> now, with:
>>
>> /(html jQuery this grid
>>     gridComplete: 'alert(''Bing'')' asFunction;.../
>>
>> I get an alert when clicking at the cell.
>>
>> But I dont know how to get the selected model instance within
>> smalltalk (for
>> further editing).
>> Can anyone help?
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/JQGrid-Events-tp3787423p4647456.html
>> Sent from the Seaside General mailing list archive at Nabble.com.
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JQGrid Events

Sabine Manaa
Thank you both,
This was it

JQGrid>>onCellSelect: aFunction
   self optionAt: 'onCellSelect' put: (aFunction asFunction: #('rowId' 'iCol' 'cellcontent' 'e'))

...
onCellSelect:
   (html jQuery ajax
      callback: [ :val | val inspect ] value: (JSStream on: 'rowId');
      callback: [ :val | val inspect ] value: (JSStream on: 'iCol');

Have a nice Weekend
Sabine