Storing Smalltalk References in JS

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

Storing Smalltalk References in JS

Sean P. DeNigris
Administrator
I'm using jstree to represent Smalltalk objects logically organized as a tree. When the user selects a node, I want to send a message to the Smalltalk object corresponding to it. However, how do I store a reference to the Smalltalk object in the jstree? I'm using html as data - is there an object id/pointer that I could write as an attribute of the tag? Or is there a better way?

Thanks.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Storing Smalltalk References in JS

Sean P. DeNigris
Administrator
Sean P. DeNigris wrote
how do I store a reference to the Smalltalk object in the jstree? I'm using html as data - is there an object id/pointer that I could write as an attribute of the tag? Or is there a better way?
Bump ;) Anyone... Bueller...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Storing Smalltalk References in JS

Herby Vojčík
In reply to this post by Sean P. DeNigris
Smalltalk aside, when putting JS objects into DOM, jQuery's data() comes first to mind. Or do you need something else?

"Sean P. DeNigris" <[hidden email]>napísal/a:

>Sean P. DeNigris wrote
>> how do I store a reference to the Smalltalk object in the jstree? I'm
>> using html as data - is there an object id/pointer that I could write as
>> an attribute of the tag? Or is there a better way?
>
>Bump ;) Anyone... Bueller...
>
>
>
>-----
>Cheers,
>Sean
>--
>View this message in context: http://forum.world.st/Storing-Smalltalk-References-in-JS-tp4768186p4768620.html
>Sent from the Amber Smalltalk mailing list archive at Nabble.com.
>
>--
>You received this message because you are subscribed to the Google Groups "amber-lang" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Storing Smalltalk References in JS

Sean P. DeNigris
Administrator
Herby Vojčík wrote
jQuery's data() comes first to mind
Looks perfect!

'#div_id' asJQuery data: 'obj' put: myInstance
('#div_id' asJQuery data: 'obj') smalltalkMessage
works like a charm - thanks :)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Storing Smalltalk References in JS

Sean P. DeNigris
Administrator
Sean P. DeNigris wrote
'#div_id' asJQuery data: 'obj' put: myInstance
('#div_id' asJQuery data: 'obj') smalltalkMessage
works like a charm - thanks :)
Drats - jsTree clears the data during its magical initialization :( I asked how others are handling this on SO... https://stackoverflow.com/questions/24842453/jstree-bind-to-domain-objects
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Storing Smalltalk References in JS

Tim Mackinnon
It's a great question - keen to hear the response so we can learn how to do things like this.

Tim

On 19 Jul 2014, at 19:08, Sean P. DeNigris <[hidden email]> wrote:

> Sean P. DeNigris wrote
>> '#div_id' asJQuery data: 'obj' put: myInstance
>> ('#div_id' asJQuery data: 'obj') smalltalkMessage
>> works like a charm - thanks :)
>
> Drats - jsTree clears the data during its magical initialization :( I asked
> how others are handling this on SO...
> https://stackoverflow.com/questions/24842453/jstree-bind-to-domain-objects
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Storing-Smalltalk-References-in-JS-tp4768186p4768720.html
> Sent from the Amber Smalltalk mailing list archive at Nabble.com.
>
> --
> You received this message because you are subscribed to the Google Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Storing Smalltalk References in JS

Sean P. DeNigris
Administrator
Tim Mackinnon wrote
It's a great question - keen to hear the response so we can learn how to do things like this.
jQuery data seems to be the way to go. The only twist with jsTree is that the data gets moved for optimization reasons, so it must be accessed in the callback like so:
    $('#jsTree_div').on('select_node.jstree', function (e, data) {
        data.node.data.some_key //... (instead of $('#node_id').data('some_key'))
    });

I answered and updated the SO question http://stackoverflow.com/questions/24842453/jstree-bind-to-domain-objects
Cheers,
Sean