Property functions vs Events: What am I missing

Ok, so I'm making my way to understanding Webix. For example, I have a basic form:

https://webix.com/snippet/9ff155b3

But here's what I'm finding. Some events, like "click", are properties you pass in anonymous functions to, which seems to work well. But others, like the forms' onsubmit, don't seem to work that way; they have to be bound separately in a somewhat clunky way. (Eg, on the example above, the onsubmit property doesn't work!)

Am I missing something? Is there a consistent way of handling events with webix?

Comments

  • Hi,

    It's a question of syntax. If you define events within component's configuration, you need to declare them in on:{ } property: https://webix.com/snippet/f33c3aa1

    In the same time, there are specific event handlers for common purposes: click (for inputs) and ready (for data components). Please check also the related article in the documentation.

  • Thanks, Listopad. Is it fair to say then that the click handler is something of a shortcut for on: {onClick: ...}?

  • edited May 18

    To be precise, for controls (text, button, etc.) it is similar to

    on:{ onItemClick: /**/ }

    onClick is also a specific property (outsideon object) for data components, which allows setting separate click handlers to particular CSS classes, for example:

    {
        view:"list", 
        template:"#title# <span class='info'>Click for details</span>",
        onClick:{
            'info':function(event, itemId){ /**/ }
        }
    }
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion