<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 10, 2013 at 7:27 AM, Diego Lont <span dir="ltr">&lt;<a href="mailto:diego.lont@delware.nl" target="_blank" class="vt-p">diego.lont@delware.nl</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Mariano,<div><br></div>


<div>A bit longer answer.</div><div><br></div></div></blockquote><div><br></div><div>Thanks for your detailed answer. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div style="word-wrap:break-word"><div></div><div>I added an example to the QC Magritte Demo to show how this can be done. I added it to the last demo (form demo).</div><div><br></div><div>There are actual several ways to do this in QC Magritte, but I implemented what I think is the most elegant one for this problem.</div>


<div><br></div><div>First you need to make sure the QC Magritte stuff is used, so in the domain object we implement to following 2 methods:</div><div><div>mementoClass</div><div><span style="white-space:pre-wrap">        </span>^QCAjaxMemento </div>


</div><div><br></div><div>The normal memento is not aware of the class and will not process and domain rules, other than validations set in the descriptions. We need to update the values of other objects as well, so this allows for influences and hidden fields.</div>


<div><br></div><div><br></div><div><div>setDefaultsFor: aContainer</div><div><span style="white-space:pre-wrap">        </span>&lt;magritteContainer&gt;</div><div><span style="white-space:pre-wrap">        </span>^aContainer</div><div>


<span style="white-space:pre-wrap">                </span>componentRenderer: QCGroupedFormRenderer;</div><div><span style="white-space:pre-wrap">                </span>componentClass: QCContainerComponent;</div><div><span style="white-space:pre-wrap">                </span>descriptionBuilder: QCDescriptionFlattener;</div>


<div><span style="white-space:pre-wrap">                </span>yourself</div></div><div><br></div><div>This basically overrides the default component class, component renderer and adds a description builder.</div><div><br></div><div>The component renderer adds the AJAX stuff. This renderer adds a callback to each element of a group, that re renders the group when it is changed. Also it allows for groups to be collapsed by the user.</div>


</div></blockquote><div><br></div><div><br></div><div>OK, I understand. One problem I have right now is that QCGroupedFormRenderer and its superclass changes the way things are rendered, add bootstrap CSS classes etc...Moreover, I have my own subclass of MATableRenderer where I change a few things. I have #myAsComponent which does:</div>

<div><br></div><div><div><span style="white-space:pre-wrap">        </span>^ self magritteDescription</div><div><span style="white-space:pre-wrap">                </span>componentRenderer: MyTableRendered &quot;QCGroupedFormRenderer&quot;;<span style="white-space:pre-wrap">                </span></div>

<div><span style="white-space:pre-wrap">        </span> <span style="white-space:pre-wrap">        </span>asComponentOn: self</div></div><div> </div><div><br></div><div>QCGroupedFormRenderer does what I need but also much more. So...do you know what is the easiest way so that I can reuse the ajax for the groups? I just need that I can group things and that when one of them is changed, all the rest of the group are re-rendered. So all #renderEditorOn: html ajaxScript: aScript are very useful. The key part I think it is this:</div>

<div><br></div><div>| script |</div><div><span style="white-space:pre-wrap">                                        </span></div><div><span style="white-space:pre-wrap">                                        </span>groupDescriptions ifNil: [ script := self createUpdaterFor: aDescription id: anId serialize: (childComponent serializeScriptOn: html) ]</div>

<div><span style="white-space:pre-wrap">                                                </span>ifNotNil: [ self halt. script := self createUpdaterForList: groupDescriptions id: anId serialize: (childComponent serializeScriptOn: html) group: group ].</div><div>
<span style="white-space:pre-wrap">                        </span>childComponent renderContentOn: html ajaxScript: script ] </div><div><br></div><div>soo any idea how could I plug that into say MATableRenderer (then I take care of my subclass)?  I am not sure where I should get the groupDescriptions from...</div>

<div>I think that having a subclass of MATableRenderer with *ONLY* that ability would be super awesome. <br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div style="word-wrap:break-word">
<div><br></div><div>The component class makes sure the description builder is used to process the description. The description builder you probably don&#39;t need, but it processes the description, before it is shown, allowing for defaults, security and such. The descriptionFlattener is expanding relations to groups, allowing to use nested objects. I.E. a person has an address, and you want to model this as a different object. But when you edit a person, you usually want to be able to change the address, without switching pages.</div>


<div><br></div><div>If you do not want to use the description builder, setting the component renderer will suffice.</div><div><br></div></div></blockquote><div><br></div><div>Indeed. I want to start with something very simple and just be able to re-render other descriptions when one is modified.</div>
<div><br></div><div>Thanks Diego, </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word"><div></div><div>For more information on QC Magritte see: <a href="http://smalltalkhub.com/#!/~DiegoLont/QCMagritte" target="_blank" class="vt-p">http://smalltalkhub.com/#!/~DiegoLont/QCMagritte</a></div>


<div><br></div><div>Cheers,</div><div>Diego</div><div><br><div><div><div><div>On Dec 9, 2013, at 9:28 PM, Mariano Martinez Peck wrote:</div><br></div></div><blockquote type="cite"><div><div><div dir="ltr">
Hi guys. I have lots of seaside forms with magritte. One problem I have now is that I want to refresh the form once an item from a combo list has been selected. For example, the typical set country / state (or provice). In other words...I want to refresh the form once certain fields are choose. <div>



I did not find this functionality available in Magritte-Seaside. I am missing something?</div><div><br></div><div>Thanks in advance, <br><div><div><br></div>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com/" target="_blank" class="vt-p">http://marianopeck.wordpress.com</a><br>




</div></div></div></div></div><div>
_______________________________________________<br>seaside mailing list<br><a href="mailto:seaside@lists.squeakfoundation.org" target="_blank" class="vt-p">seaside@lists.squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank" class="vt-p">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>


</div></blockquote></div><br></div></div><br>_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank" class="vt-p">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank" class="vt-p">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank" class="vt-p">http://marianopeck.wordpress.com</a><br>
</div></div>