Annoying "Incorrect id in select command" error in debug-mode Webix upon `list.remove(id)`

http://jsbin.com/bumece

webix.ui({
  view: 'list',
  id: 'myList',
  template: '#text# <a class="removeItem" href="javascript:void(0)" style="float: right">remove</a>',
  select: true,
  autoheight: true,
  navigation: true,
  on: {
    onItemClick: function(id, evt, el) {
      if ($(evt.target).is('a.removeItem')) // jQuery required
        this.remove(id) // <<<< this triggers an error <<<<
    },
  },
  data: [
    {text:'lorem'},
    {text:'ipsum'},
    {text:'dolor'},
    {text:'sit'},
    {text:'amet'},
  ],
})

Comments

  • use myList.remove(id) instead of this

  • By default list will try to select clicked record and as it absent it will show the assert message. ( it is not really a error, just inner self-checking )

    You can change the code like follows

     navigation: true,
     on_click: {
        removeItem:function(ev, id){
             this.remove(id);
             return false;
        }
      },
      data: [
    

    http://docs.webix.com/api__link__ui.list_on_click_other.html

    It will remove jQuery code, and will resolve the selecting assert as well. As method returns false the default onclick handler will not be triggered, so there will be no attempt to select a deleted record.

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!