<div>Ok. I ask you becouse GRSmallDictionary have method with js concern.</div><div><br></div><div>Now, in my image Pharo 1.3, the class comment on SmallDictionary is same to RBSmallDictionary, but last class is smaller even. But, with neither of those classes the code of example works fine.</div>
<div><br></div><div>|dict array value1 value2|<br> value1 := 'abcd'.<br> value2 := 12345.<br> dict:= <font color="#ff0000">SmallDictionary</font> new.<br> dict at: 'subop1' put: value1.<br> dict at: 'subop2' put: value2.<br>
array:=Array with: dict.<br> array asJson => <font color="#009900"> '[["abcd",12345]]'</font></div><div><br></div><div>and this one throw a exception</div><div><br></div><div>|dict array value1 value2|<br>
value1 := 'abcd'.<br> value2 := 12345.<br> dict:= <font color="#ff0000">RBSmallDictionary</font> new.<br> dict at: 'subop1' put: value1.<br> dict at: 'subop2' put: value2.<br> array:=Array with: dict.<br>
array asJson => <font color="#009900">'Override #jsonOn: to make the receiver serializeable as JSON'</font></div><div><br></div><div><br></div><div>Finally, I will use the Dictionary class, and I go on coding my widget :)</div>
<div><br></div><div>Thanks Paul.</div><div><br></div><div><br></div><div class="gmail_quote">2011/9/1 Paul DeBruicker <span dir="ltr"><<a href="mailto:pdebruic@gmail.com">pdebruic@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I don't know when it would matter or when users would notice a difference, performance wise. See the class comment on SmallDictionary and see if that is better suited to your plugin's use case than just a regular Dictionary. The GRSmallDictionary is a cross platform compatible implementation of the SmallDictionary.<br>
<br>
I'm sure both would be fine for most use cases.<div class="im"><br>
<br>
<br>
<br>
<br>
On 09/01/2011 05:12 PM, Gastón Dall' Oglio wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
I see in the JQPluing class<br>
<br>
optionAt: aKey put: aValue<br>
^ self options at: aKey put: aValue<br>
<br>
and<br>
<br>
options<br>
^ options ifNil: [ options := GRSmallDictionary new ]<br>
<br>
Then, is better use GRSmallDictionary for the subops pairs? Like this:<br>
<br>
|dict array value1 value2|<br>
value1 := 'abcd'.<br>
value2 := 12345.<br>
dict:= GRSmallDictionary new.<br>
dict at: 'subop1' put: value1.<br>
dict at: 'subop2' put: value2.<br>
array:=Array with: dict.<br>
array asJson<br>
<br>
<br>
2011/9/1 Gastón Dall' Oglio <<a href="mailto:gaston.dalloglio@gmail.com" target="_blank">gaston.dalloglio@gmail.com</a><br></div>
<mailto:<a href="mailto:gaston.dalloglio@gmail.com" target="_blank">gaston.dalloglio@gmail.com</a>>><div class="im"><br>
<br>
Ohhhhh of course, a Array with a Dictionary!!! This was so obvious<br>
(but not for me jeje).<br>
When I complete my first JQWidget, I share it with you.<br>
Thanks.<br>
<br>
2011/9/1 Paul DeBruicker <<a href="mailto:pdebruic@gmail.com" target="_blank">pdebruic@gmail.com</a><br></div>
<mailto:<a href="mailto:pdebruic@gmail.com" target="_blank">pdebruic@gmail.com</a>>><div><div class="h5"><br>
<br>
You need to create a Dictionary and then put that in your array<br>
<br>
You can test it in a workplace like this:<br>
<br>
|dict array value1 value2|<br>
value1 := 'abcd'.<br>
value2 := 12345.<br>
dict:=Dictionary new.<br>
dict at: 'subop1' put: value1.<br>
dict at: 'subop2' put: value2.<br>
array:=Array with: dict.<br>
array asJson<br>
<br>
<br>
<br>
<br>
<br>
so your code should become<br>
<br>
self optionAt: 'op1' put (Array with: aDictionary).<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
On 09/01/2011 10:40 AM, Gastón Dall' Oglio wrote:<br>
<br>
Hello.<br>
<br>
I'm writing a new JQWidget component and I need generate js<br>
code like<br>
this for correctly load of the wrapped plugin:<br>
$("#id").funcname({"op1":[{"subop1":"value1","subop2":"value2",...}],...});<br>
<br>
<br>
I don't know how do it. I have a method<br>
JQMyWidget>>subop1:value, where<br>
I write some [stupid] implementation:<br>
<br>
1) self optionAt: 'op1' put: (Array with: 'subop1' with:<br>
value) =><br>
$("#id").funcname({"op1":["subop1","value"]})<br>
<br>
2) self optionAt: 'op1' put: ('subop1' -> value) =><br>
$("#id").funcname({"op1":'subop1'->'value'})<br>
<br>
3) self optionAt: 'op1' put: (self optionAt: 'subop1' put:<br>
value) =><br>
$("#id").funcname({"op1":"value","subop1":"value"})<br>
<br>
Any idea? Thanks in advance.<br>
<br>
<br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br></div></div>
<mailto:<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a>><div class="im"><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br>
<br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br></div>
<mailto:<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a>><div class="im"><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</div></blockquote><div><div class="h5">
<br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</div></div></blockquote></div><br>