Announcement

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

    context menu to startEditingNew

    not sure if this is a bug or i'm doing it wrong. i've got a list grid with inline, modal editing. i've got a context menu on the list grid to initiate creating a new record in the grid. clicking the menu item should show a new empty record for the user to enter data then save. this works fine in firefox, but when i do it on IE, the listgrid shows a new row in the grid and immediately closes the new row (before the user could enter any data to the row), thus attempting to send the blank record to the server for an add operation. here's a test case

    Code:
    	isc.DataSource.create({
    		ID: "ds_001",
    		dataFormat: "xml",
    		dataProtocol: "getParams",
    		dataTransport: "xmlHttpRequest",
    		operationBindings: [
    			{
    				operationType: "fetch",
    				recordXPath: "/XX",
    				dataURL: "/findXX"
    			},
    			{
    				operationType: "add",
    				recordXPath: "/XX",
    				dataURL: "/createXX"
    			}
    		],
    		fields: [
    			{name: "Id", type: "staticText", primaryKey: true},
    			{name: "Name", type: "text"}
    		]
    	});
    
    	isc.Menu.create({
    	    ID: "cm_001",
    	    data:[
    	        {title: "Create New", click: function() {
    	        	lg_002.startEditingNew();
    	        }}
    	    ]
    	});
    	
    	isc.HLayout.create({
    		autoDraw: true,
    		members: [
    			isc.ListGrid.create({
    				ID: "lg_002",
    				contextMenu: cm_001,
    				dataSource: "ds_001",
    				autoFetchData: false,
    				height: 400,
    				width: 300,
    				modalEditing: true,
    				fields: [
    					{name: "Id"},
    					{name: "Name"}
    				]
    			}),
    			isc.IButton.create({
    				title: "Create New",
    				click: function() {
    			        lg_002.startEditingNew();
    				}
    			})
    		]
    	});
    Using IE and smartclient 5.7:
    Creating the first record in the list grid won't cause any problems, it only happens after creating the first record, then using the context menu to create a new record. Using the button on the side of the listgrid doesnt have any problems.

    #2
    Hi Jesse,
    Two things here.

    Firstly - yes - you've hit an Internet Explorer specific SmartClient bug.
    Thanks for bringing this to our attention - we've now created a patch for this issue - available here.

    Secondly:
    In your code you should change your primary key field definition from
    Code:
    {name: "Id", type: "staticText", primaryKey: true},
    to
    Code:
    {name: "Id", canEdit:false, primaryKey: true},
    When editing a listgrid record, certain logic relies on the 'canEdit' property for a field being set to false if the field should not be editable, rather than just using a static form item type such as the staticTextItem. This is why in your example when you call 'startEditingNew()' the new row doesn't get focus inserted into the appropriate editor.


    Let us know if you run into problems


    Thanks

    Isomorphic Software

    Comment

    Working...
    X