we focus on the del button: function dodelmessage(mid:Number,index:Number) { //mx.controls.Alert.show(index.toString()); RO_messagemanage.delMessage(mid);//it a RemoteObject call //repeater_message.dataProvider.removeItemAt(index); } function completedelMessage(event) { RO_messagemanage.getMessage(cbo_message_classlist.selectedItem.cid,pagesize,c urrentpage); } function completegetMessage(event) { repeater_message.dataProvider=event.result; } now when i deleted a piece of message, i reset the repeater_message.dataProvider. but at first , i want to use repeater_message.dataProvider.removeItemAt(index) which i do not to connection to flex server .if i use function dodelmessage(mid:Number,index:Number) { mx.controls.Alert.show(index.toString()); //RO_messagemanage.delMessage(mid);//it a RemoteObject call repeater_message.dataProvider.removeItemAt(index); } when i delete first piece of message ,mx.controls.Alert.show is 0;then the components of first message disapear. then i continiue to delete next message, mx.controls.Alert.show is 1, but the components will not be deleted. I guess that the index in click event now is not in order with the index of dataprovider. [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => balrog1983 [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 6 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> The button(in repeater)'s click event - Macromedia Flex General Discussion

The button(in repeater)'s click event - Macromedia Flex General Discussion

Removed by Administrator...

  1. Moderated Post

    Default The button(in repeater)'s click event

    Removed by Administrator
    balrog1983 Guest
    Moderated Post

  2. #2

    Default Re: The button(in repeater)'s click event

    What is not working?
    Post a complete sample app.
    Try this sample app, perhaps it will help:
    [url]http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&object ID=199[/url]
    Tracy
    ntsiii Guest

  3. #3

    Default Re: The button(in repeater)'s click event

    Oh, I see. you cannot use currentIndex in a run-time function call like that,
    is only exists when the repeater is instatiating, not at run time.

    See this link for another example, plus look into getChildIndex(). I'll post
    an example if I have time later.

    Tracy

    ntsiii Guest

  4. #4

    Default Re: The button(in repeater)'s click event

    mmm... I have followed your key and found to call
    repeater_message.dataProvider.removeItemAt(index); //here index=0., the 0 row
    in dataProvider will be deleted and the components with 0 row will disapear.
    but , notice that, after deleted, old 1 row will now be 0 row,but,it's click
    event is still index 1??

    balrog1983 Guest

  5. #5

    Default Re: The button(in repeater)'s click event

    No.

    Post a sample app.

    Tracy
    ntsiii Guest

  6. #6

    Default Re: The button(in repeater)'s click event

    here is a code segment of messageboard sample :
    <mx:Repeater id="repeater_message">
    <mx:Label/>
    <mx:HBox>
    <mx:FormItem label="issuer:">
    <mx:Label id="issuename" text="{repeater_message.currentItem.issuename}"/>
    </mx:FormItem>
    <mx:Button textAlign="right" label="del"
    visible="{repeater_message.currentItem.teacher}"
    click="dodelmessage(event.target.getRepeaterItem() .mid,event.target.instanceInde
    x)"/>
    <!--notice the click event above-->
    </mx:HBox>
    <mx:HRule width="100%" />
    <mx:HBox>
    <mx:FormItem label="issuedate">
    <mx:Label id="issuedate" textAlign="left"
    text="{repeater_message.currentItem.issuedate}"/>
    </mx:FormItem>
    </mx:HBox>
    <mx:HRule width="100%" />
    <mx:Text id="message" text="{repeater_message.currentItem.message}"
    width="100%"/>
    <mx:HRule width="100%" />

    </mx:Repeater>

    <mx:RemoteObject id="RO_messagemanage" source="gujing.flex.CMessageManage"
    showBusyCursor="true"
    fault="mx.controls.Alert.show('???????????', '??')">
    <mx:method name="getMessage" result="completegetMessage(event)"/>
    <mx:method name="delMessage" result="completedelMessage(event)"/>
    <mx:method name="addNewMessage" result="completeaddNewMessage(event)"/>
    </mx:RemoteObject>

    we focus on the del button:
    function dodelmessage(mid:Number,index:Number)
    {
    //mx.controls.Alert.show(index.toString());
    RO_messagemanage.delMessage(mid);//it a RemoteObject call
    //repeater_message.dataProvider.removeItemAt(index);
    }
    function completedelMessage(event)
    {

    RO_messagemanage.getMessage(cbo_message_classlist. selectedItem.cid,pagesize,c
    urrentpage);
    }
    function completegetMessage(event)
    {
    repeater_message.dataProvider=event.result;

    }
    now when i deleted a piece of message, i reset the
    repeater_message.dataProvider. but at first , i want to use
    repeater_message.dataProvider.removeItemAt(index) which i do not to connection
    to flex server .if i use function dodelmessage(mid:Number,index:Number)
    {
    mx.controls.Alert.show(index.toString());
    //RO_messagemanage.delMessage(mid);//it a RemoteObject call
    repeater_message.dataProvider.removeItemAt(index);
    }
    when i delete first piece of message ,mx.controls.Alert.show is 0;then the
    components of first message disapear. then i continiue to delete next message,
    mx.controls.Alert.show is 1, but the components will not be deleted. I guess
    that the index in click event now is not in order with the index of
    dataprovider.

    balrog1983 Guest

  7. #7

    Default Re: The button(in repeater)'s click event

    Have I explained the situation clear?I wanna know the solution.
    balrog1983 Guest

  8. #8

    Default Re: The button(in repeater)'s click event

    Your code is still to complex for me to see anything. Take out everything that
    is not neded to demonstrate the problem, hard-code some data for the data
    provider, and create a complete runnable sample app.

    And use the "Attach Code" button so the format is not so ugly.

    ntsiii Guest

  9. #9

    Default Re: The button(in repeater)'s click event

    Not sure if this is resolved but instead of using event.target.getRepeaterItem().[your_field] inside the click event, I used event.currentTarget.getRepeaterItem().[your_field] and it worked.

    click="GetDetail(event.currentTarget.getRepeaterIt em().ItemID)" />
    rueldeleon123 Guest

Similar Threads

  1. Button Click Event Not Working
    By JeffHung in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: May 11th, 09:11 AM
  2. button click event from inside a list
    By tremerator@hotmail.com in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: October 20th, 08:32 PM
  3. SIMULATE / FORCE A BUTTON CLICK OR EVENT
    By drforbin1970 in forum Coldfusion Flash Integration
    Replies: 0
    Last Post: August 2nd, 04:53 PM
  4. Replies: 2
    Last Post: May 28th, 06:23 AM
  5. Cannot recieve click event on Link Button
    By developer1996 in forum ASP.NET Building Controls
    Replies: 2
    Last Post: July 8th, 12:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •