Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
How to maintain multi selection range oncontextmenu click event ?
posted

i want to select multiple range in infragistics webMonthCalender control by draging the selection,it work fine, when i right click on calender my javascript contextmenu is open but the selected range is lost and new date is select, kindly help me how i persist multiple selection oncontextmenu event. thanks

  • 22852
    Offline posted

    Hello,

    I am adding an example that shows how you can use the client side MouseDown of the WebMonthCalendar to retain the selection and also show a context menu.

    Client side code:

    function WebDataMenu1_ItemClick(sender, eventArgs) {
        alert(eventArgs.getItem().get_text() + $find("WebMonthCalendar1").get_selectedDates());
    }
     
    function WebMonthCalendar1_MouseDown(sender, eventArgs) {
        if (eventArgs._props[0].button == 2) {
            // the following will allow you to retain the selection on the right mouse button down.
            eventArgs.set_cancel(true);
            var menu = $find("WebDataMenu1");
            menu.showAt(nullnull, eventArgs.get_browserEvent());
        }	
    }
    

    Markup:

    <ig:WebDataMenu ID="WebDataMenu1" runat="server" IsContextMenu="True">
        <Items>
            <ig:DataMenuItem Key="Edit" Text="Edit">
            </ig:DataMenuItem>
            <ig:DataMenuItem Key="Cancel" Text="Cancel">
            </ig:DataMenuItem>
        </Items>
        <ClientEvents ItemClick="WebDataMenu1_ItemClick" />
    </ig:WebDataMenu>
        
    <ig:WebScriptManager ID="WebScriptManager1" runat="server">
    </ig:WebScriptManager>
    <ig:WebMonthCalendar ID="WebMonthCalendar1" runat="server" 
        SelectionType="Multi">
        <ClientEvents MouseDown="WebMonthCalendar1_MouseDown" />
    </ig:WebMonthCalendar>

    Let me know if you have any questions with this matter.

  • 7566
    posted

    Hello Arsalan_bs,

     

    Our controls handles on click, so when you make a right button click the expected is the selection to be lost. You can handle mouse click on the control and to save the selected items and set them selected after that depending on the scenario that you need to implement. And this will be a custom implementation.

     

    If you need further assistance with this matter do not hesitate to contact me.

     

    Sincerely,

    Georgi Sashev

    Developer Support Engineer

    Infragistics, Inc.