jQuery UI Widgets Forums Lists ListBox Dynamic content onclick

This topic contains 8 replies, has 3 voices, and was last updated by  Chris99 9 years, 1 month ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • Dynamic content onclick #70380

    Chris99
    Participant

    Hi,

    I have a list box with checkboxes enabled and a custom renderer. This creates a table for each item in the list box, and the table has an onclick handler. The problem I am having is that the first click on the list box items is never detected, but all other ones are. Can you work out why this may be?

    I have put together an example http://jsfiddle.net/Chris99/599z0tb6/

    Cheers,

    Chris

    Dynamic content onclick #70384

    Nadezhda
    Participant

    Hello Chris,

    The above example works on our side. Please, make sure you are using the latest version of jQWidgets(3.8.0).

    Best Regards,
    Nadezhda

    jQWidgets team
    http://www.jqwidgets.com/

    Dynamic content onclick #70416

    Chris99
    Participant

    Whilst I am working with 3.7.1 (I will update today) my Fiddle is using 3.8.0 and exhibits the behaviour I described in Firefox and Chrome.

    What should happen it that every click to the section of the list box to the right of the checkbox shoud show an alert. However the first click does not produce an alert. All other clicks do however produce the alert.

    Please can you have another look.

    Chris

    Dynamic content onclick #70428

    Peter Stoev
    Keymaster

    Hi Chris,

    We tested the sample. Unfortunately, the sample tries to use event which is not supported. With jqxListBox, you can use only the events documented on the ListBox’s API page. The custom renderers are only for displaying custom HTML content, but you shouldn’t try to bind to events within the custom renderer.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Dynamic content onclick #70433

    Chris99
    Participant

    Hi Peter,

    Thanks for confirming you were able to reproduce what I was seeing. I took the idea from a post of yours http://www.jqwidgets.com/community/topic/events-on-custom-rendered-elements/. I appreciate this is two years old, but I had hoped it was an approved way of doing things.

    Cheers,

    Chris

    • This reply was modified 9 years, 1 month ago by  Chris99.
    Dynamic content onclick #70436

    Peter Stoev
    Keymaster

    Hi Chris,

    The sample there is a workaround. Workarounds generally should be avoided and things should be used in the documented way. We don’t support workarounds in newer versions and don’t test them when we change API or behavior in widgets. The workaround there is also about a ListBox without checkboxes which matters, because it was prepared for a very specific scenario. If you want to use a workaround, use this: http://jsfiddle.net/5r4uzzm9/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Dynamic content onclick #70446

    Chris99
    Participant

    Thank you for trying Peter, I really appreciate the time you have taken.

    Unfortunately although this works perfectly on the desktop, when built into a PhoneGap application and deployed onto an Android device the mousedown event is not recognised.

    Thanks again for your assistance,

    Chris

    Dynamic content onclick #70450

    Peter Stoev
    Keymaster

    Hi Chris,

    For other devices, you will probably need to add handler for “touchstart” and by using jqxResponse check whether the device is Desktop or other.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Dynamic content onclick #70454

    Chris99
    Participant

    Thanks Peter,

    I am looking at this, but have been unable to get is working yet either on a device or when using device emulation in Chrome Developer tools.

    Cheers,

    Chris

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.