[CLOSED] GridEditing - prevent empty entry

  1. #1

    [CLOSED] GridEditing - prevent empty entry

    I have a date and text editor in an editable grid.
    If user deletes entry, I want to tell them they can't, return focus to cell they were editing, and preserve the previous value...
    Seems simple enough...can't seem to get there...

    
                var EditHandlerMaturity= function (editor, e) {
                     
                    if(e.field=='MaturityDate')
                    { 
                        if (e.value==null)
                        {
                            NotifyContextDown('Ooops','You can only change the date. If you want to delete the entry all together, please use the delete icon to the right.',e.grid.el);
                         
                            editor.cancelEdit(); ??
                                   //  e.grid.stopEditing(); ???
                            
                            return;
                        }
                    }
    Last edited by Daniil; Oct 08, 2013 at 6:49 AM. Reason: [CLOSED]
  2. #2
    Hello!

    To validate and cancel values, it's better to use ValidateEdit event: http://docs.sencha.com/extjs/4.2.2/#...t-validateedit

    <ext:CellEditing runat="server" ClicksToEdit="1">
    	<Listeners>
    		<ValidateEdit Handler="
    			if (e.value == null || e.value.length == 0) {
    				Ext.Msg.alert('No value', 'Wrong value');
    			
    				e.cancel = true;
    			
    				return false;
    			}
    			"></ValidateEdit>
    	</Listeners>
    </ext:CellEditing>

Similar Threads

  1. Replies: 5
    Last Post: May 17, 2013, 11:54 AM
  2. Replies: 6
    Last Post: Jan 21, 2012, 7:45 PM
  3. web.config entry for coolite 0.8 and IIS7
    By kumarvss in forum 1.x Help
    Replies: 9
    Last Post: Sep 26, 2011, 11:08 AM
  4. [CLOSED] Custom Search Combobox entry
    By sriram in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 29, 2011, 10:01 AM
  5. How i validate a entry??
    By carlosmupe in forum 1.x Help
    Replies: 2
    Last Post: Dec 11, 2009, 3:20 PM

Posting Permissions