[Infusion-users] Inline Edit (simple) Undo/redo

Harris Wong harris.wong at utoronto.ca
Fri Jan 22 16:03:48 UTC 2010


Thanks for the advice! Undo seems to be fine with the source object, and 
so I added a conditional statement in the listener and it seems to be 
working fine now.  Here is my code:

modelChanged: function(model, oldModel, source){
                 if (model != oldModel && source != undefined){
                     viewNode = 
source.component.container.children('.flc-inlineEdit-text')[0];
                     rtn = jQuery.post("<?php echo $_base_path. 
AT_PA_BASENAME.'edit_comment.php';?>",
                         {"submit":"submit",
                          "pid":<?php echo $this->photo_info['id'];?>,
                          "aid":<?php echo $this->aid;?>,
                          "cid":viewNode.id,
                          "comment":model.value},
                           function(data){},
                           "json");
                 }
             },

Thanks again!


Harris


On 22/01/2010 10:56 AM, Justin Obara wrote:
> Hello Harris,
>
> In talking with some others one possible workaround would be to do something like using the single inlineEdit and attaching a listener to each inline edit field individually. (i'm assuming you are using inlineEdits). That way you can have your listener function know what inline edit field it is attached and you won't need to have the source passed down to it.
>
> I think this should work.
> Justin
>
> On 2010-01-22, at 9:17 AM, Justin Obara wrote:
>
>    
>> Hello,
>>
>> On some further investigation, it appears that there may be a bug that seems to not provide the source for changes to the model that happen internally. (e.g. user input into the field).
>>
>> I have a filed a jira for this.
>> http://issues.fluidproject.org/browse/FLUID-3483
>>
>> However, undo seems to provide the source appropriately, so you should still be able to use that to find out when the model is changed and get the source back appropriately in that case.
>>
>> I hope that this issue will be addressed in time for our next release.
>>
>> - Justin
>>
>> On 2010-01-21, at 1:43 PM, Harris Wong wrote:
>>
>>      
>>> Yep, but at times it becomes undefined.....
>>>
>>> On 21/01/2010 1:40 PM, Justin Obara wrote:
>>>        
>>>> Hello,
>>>>
>>>> The modelChanged event also passes along a source, which should allow you to find out which inlineEdit field it was that changed.
>>>>
>>>> - Justin
>>>> On 2010-01-21, at 10:27 AM, Harris Wong wrote:
>>>>
>>>>
>>>>          
>>>>> Thanks, that helps.  But is there a way to get the current node that I am on?  Such as the viewNode in afterFinishEdit.
>>>>>
>>>>> Thanks,
>>>>> harris
>>>>>
>>>>> On 21/01/2010 9:08 AM, Justin Obara wrote:
>>>>>
>>>>>            
>>>>>> Hello Harris,
>>>>>>
>>>>>> It seems that the event that you want to be listening to is "modelChanged". This event should fire every time the model is changed, including when a call to undo/redo is made. Both the new and the old model are passed to the modelChanged event, which should provide you with the correct data to update the database with.
>>>>>>
>>>>>> Hope that helps
>>>>>> Justin
>>>>>> On 2010-01-20, at 4:50 PM, Harris Wong wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>              
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have a question on the undo/redo function from the Fluid Inline Edit (Simple) demo.  When I clicked undo, it didn't revert the value back in the database.  In other words, I didn't see any events being fired when I clicked "undo".  I tried looking for the "componentDecorators" and the "undoDecorator" on http://wiki.fluidproject.org/display/fluid/Simple+Text+Inline+Edit+API#SimpleTextInlineEditAPI-SupportedEvents, but I couldn't find anything.  Can someone kindly points me to the API for the undoDecorator?  I afraid I am missing something in my javascript.
>>>>>>>
>>>>>>> The code that I copied was from the demo, http://fluidproject.org/releases/1.1.2/demos/inlineEdit/simple/demo.html
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Harris
>>>>>>> _______________________________________________
>>>>>>> Infusion-users mailing list
>>>>>>> Infusion-users at fluidproject.org
>>>>>>> http://fluidproject.org/mailman/listinfo/infusion-users
>>>>>>>
>>>>>>>
>>>>>>>                
>>>>>>
>>>>>>              
>>>>>            
>>>>          
>>>        
>>      
>    




More information about the Infusion-users mailing list