[Seaside] JQWidget nested options

Gastón Dall' Oglio gaston.dalloglio at gmail.com
Thu Sep 1 21:12:55 UTC 2011


I see in the JQPluing class

optionAt: aKey put: aValue
 ^ self options at: aKey put: aValue

and

options
^ options ifNil: [ options := GRSmallDictionary new ]

Then, is better use GRSmallDictionary for the subops pairs? Like this:

|dict array value1 value2|
value1 := 'abcd'.
value2 := 12345.
dict:= GRSmallDictionary new.
dict at: 'subop1' put: value1.
dict at: 'subop2' put: value2.
array:=Array with: dict.
array asJson


2011/9/1 Gastón Dall' Oglio <gaston.dalloglio at gmail.com>

> Ohhhhh of course, a Array with a Dictionary!!! This was so obvious (but not
> for me jeje).
> When I complete my first JQWidget, I share it with you.
> Thanks.
>
> 2011/9/1 Paul DeBruicker <pdebruic at gmail.com>
>
>> You need to create a Dictionary and then put that in your array
>>
>> You can test it in a workplace like this:
>>
>> |dict array  value1 value2|
>> value1 := 'abcd'.
>> value2 := 12345.
>> dict:=Dictionary new.
>> dict at: 'subop1' put: value1.
>> dict at: 'subop2' put: value2.
>> array:=Array with: dict.
>> array asJson
>>
>>
>>
>>
>>
>> so your code should become
>>
>> self optionAt: 'op1' put (Array with: aDictionary).
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On 09/01/2011 10:40 AM, Gastón Dall' Oglio wrote:
>>
>>> Hello.
>>>
>>> I'm writing a new JQWidget component and I need generate js code like
>>> this for correctly load of the wrapped plugin:
>>>
>>> $("#id").funcname({"op1":[{"subop1":"value1","subop2":"value2",...}],...});
>>>
>>>
>>> I don't know how do it. I have a method JQMyWidget>>subop1:value, where
>>> I write some [stupid] implementation:
>>>
>>> 1) self optionAt: 'op1' put: (Array with: 'subop1' with: value)     =>
>>>    $("#id").funcname({"op1":["subop1","value"]})
>>>
>>> 2) self optionAt: 'op1' put: ('subop1' -> value)     =>
>>> $("#id").funcname({"op1":'subop1'->'value'})
>>>
>>> 3) self optionAt: 'op1' put: (self optionAt: 'subop1' put: value)     =>
>>>    $("#id").funcname({"op1":"value","subop1":"value"})
>>>
>>> Any idea? Thanks in advance.
>>>
>>>
>>> _______________________________________________
>>> seaside mailing list
>>> seaside at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
>>
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20110901/23c30ff8/attachment-0001.htm


More information about the seaside mailing list