Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGird formatEditorValue issue

    SmartClient : Smartclient v9.0p_2014-01-15 - Power Edition
    Browser : IE 10




    I have editable ListGrid with editEvent: "doubleClick".

    For one of the columns, I am have to display formatted value.
    So I am overriding formatCellValue() to show formatted value in view mode
    and formatEditorValue() to show formatted value in edit. i.e. when user double click the cell.
    Looks like formatEditorValue() is not called when user tabs out of that cell and moves to next cell.

    Is there a way to format the editor value when user tabs out of the cell ? Please suggest.

    Below is my sample code
    Code:
    isc.ListGrid.create({
    	ID: "myListGrid",
    	autoFetchData: false,
    	dataSource: myDS,
    	showRollOver: true,
    	showHeaderContextMenu:false,
    	leaveScrollbarGap: false,
    	showFilterEditor:false,
    	baseStyle: "cell",
    	autoSaveEdits: false,
    	canEdit: true,
    	fields:[
    	{
    		name:"col1", canSort: true,canEdit: true,
    		formatCellValue: function (value, record, rowNum, colNum,grid) {
    			if(value!=null && !(value.isNaN)) {
    					return isc.Format.toUSString(value,2);
    			}
    			else return value;
    		},
    		formatEditorValue: function (value, record, rowNum, colNum,grid) {
    			if(value!=null && !(value.isNaN)) {
    					return isc.Format.toUSString(value,2);
    			}
    			else return value;
    			
    		},
    		parseEditorValue : function (value, record, rowNum, colNum,grid) {
    			if(value!=null ) {
    				var rawValue = value.replace(new RegExp(',', 'g'), '');
    				return rawValue;
    			}
    		},
    	},
    	{name:"col2", canSort: true,canEdit: true},
    	{name:"col3", canSort: true,canEdit: true}
    	]
    })
    Last edited by Isomorphic; 7 Jul 2014, 13:38. Reason: formatted code block

    #2
    Hi
    Just a quick follow up to let you know this is under investigation. We'll follow up when we have more information

    Regards
    Isomorphic Software

    Comment


      #3
      There isn't a simple flag for this behavior with the settings you have here.
      A couple of options would be
      - set editByCell to true - this will only show the edit item in the column the user is actually editing and as you tab off the formatted column, you'll see the user-entered value be picked, parsed and reformatted for (static) display.
      - add an editorExit handler to your field which actually calls "redraw()" on the form item handling the edit - something like this:
      Code:
          ...
      		editorExit : function (editCompletionEvent, record, newValue, rowNum, colNum, grid) {
      		    grid.getEditForm().getItem("col1").redraw();
      		},
          ...
      We'll look at whether this is supportable as a default behavior in the future but this wouldn't be something that we'd backport to the 9.0p branch

      Regards
      Isomorphic Software

      Comment


        #4
        A quick follow up on this - we've added some logic to the development branch (10.0d) which will automatically apply custom formatters when the user tabs out of a field in edit mode (this should already be available in the latest nightly build).
        We aren't currently planning to backport this to 9.1 - but you can continue using the workaround you have to achieve the same behavior there.

        Regards
        Isomorphic Software

        Comment

        Working...
        X