Jump to content

TUniSpinEdit: how to execute JS code when value is changed ?


Roberto Nicchi

Recommended Posts

I have defined this JS event

function spinend(sender, eOpts)
{
  do something with sender.value
}

but this event (of course) is not executed if the user change the component value with keyboard instead that with mouse.

I see there isn't a change event.

So how to execute the code when the value is changed ?

i have tryed with keyup event but it's executed also pressing the tabkey or other FN key. I don't know how to detect if the value has changed.

Thanks

Link to comment
Share on other sites

When the spinedit is changed i have to update a grid (clear all records and recreate records). Doing this i have an exception if the grid is in edit mode (Grid is in dirty state). My solution is to call a javascript function that is defined in the grid. This function first call the completeEdit function and after execute an ajaxRequest. In the OnAjaxEvent the grid is updated.

 

function afterCreate(sender) // this function is now executed in the spinend event of the unispinedit component
{
    sender.refresh_records = function() {

      var grid = sender;
  
      if (grid.editingPlugin.editing) {  
        grid.editingPlugin.completeEdit();
      }
      
      ajaxRequest(this, '_refresh',[]); 

    }
}

Link to comment
Share on other sites

14 hours ago, Sherzod said:

UniSpinEdit -> ClientEvents -> ExtEvents -> 


function afterrender(sender, eOpts)
{
    sender.on('change', function() {
        // change event
    })
}

 

So the event exists but is not exposed by UNGUI. I have added in in ExtEvents (Add Custom Events button) and works perfectly. Thanks

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...