Announcement

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

    What is isc.NestedListEditorItem

    I have a list grid that looks like this:

    Code:
    this.list = isc.ListGrid.create({
    				   		 width: "100%",
    				   		 canEdit: true,
    				   		 canSort: false,
    				   		 wrapCells: true,
    				   		 canDragRecordsOut: true,
    				   		 alternateRecordStyles: true,
    				   		 cellHeight: 100,
    				   		 autoSaveEdits: false,
    				   		 editEvent: "click",
    				   		 dataSource: "annotationEditorDS",
    				   		 fields: [{name: "note", type: "textArea", width: "*"},
    			                      {name: "annotationObjects", width: 250,
    			                    	  type: "canvas",
    				   		          		formatCellValue: function(value) {
    				   		          			if (value == null) {
    				   		          				return "";
    				   		          			}
    				   		          			var str = "<pre>";
    				   		          			var sep = "";
    				   		          			for (var i = 0; i < value.length; i++) {
    				   		          				var record = value[i];
    				   		          				str += sep;
    				   		          				str += record.metatype + " - " + record.name;
    				   		          				sep = "\n"
    				   		          			}
    				   		          			str += "</pre>"
    				   		          			return str;
    				   		          		},
    			                    	  editorProperties: {
    				                    	  canvasConstructor: "ListGrid",
    				                    	  setValue: function(value) {
    				   		          				this.canvas.setData([]);
    					   		        	  		this.canvas.setData(value);
    					   		          	 	},
    				                    	  canvasProperties: {
    				   			 					height: 100,
    				   			 					alternateRecordStyles: true,
    				                    	  		showHeader: false,
    				                    	  		dataSource: "associationMemberDS",
    				                    	  		canAcceptDroppedRecords: true,
    				                    	  		dragDataAction: "copy",
    				                    	  		canDragRecordsOut: true,
    				                    	  		getDragData: function() {
    					   		          	 			var selected = this.getSelection();
    					   		          	 			for (var i = 0; i < selected.length; i++) {
    					   		          	 				selected[i].requiresServer = true;
    					   		          	 			}
    					   		          	 			return selected;
    					   		          	 		},
    				                    	  		// this is the MultiAnnotationEditor
    				                    	  		parentEditor: this,
    				                    	  		recordDrop: function(droppedRecords) {
    				   			 						var topgrid = this.parentEditor.list;
    				                    	    		if (droppedRecords != null) {
    				                    	    			for (var i = 0; i < droppedRecords.length; i++) {
    				                    	    				var obj = droppedRecords[i];
    				                    		    			if (DY.hasSupertype(obj, "SemanticObject")) {
    				                    		    				var row = topgrid.getEventRow();
    				                    		    				var record = topgrid.getRecord(row);
    				                    		    				var annotid = topgrid.getRecord(topgrid.getEventRow()).dayportId;
    				                    		    				this.addData({annotationId: annotid, objectId: obj.dayportId},
    				                    		    								this.getID() + ".addAssociation(data, \"" 
    				                    		    								+ topgrid.getID()
    				                    		    								+ "\", " + row + ")");
    				                    		    			}
    				                    	    			}
    				                    	    		}
    				                    	    		return false;
    				                    	    	},
    				                    	    	addAssociation: function(data, topgridId, rownum) {
    				                    	    		this.data.add(data);
    				                    	    		var last = this.data.getLength() - 1;
    				                    	    		this.refreshRow(last);
    				                    	    		var topgrid = Canvas.getById(topgridId);
    				                    	    		var record = topgrid.getRecord(rownum);
    				                    	    		var annots = record.annotationObjects;
    				                    	    		if (annots == null) {
    				                    	    			annots = [];		
    				                    	    		}
    				                    	    		annots.add(data);
    				                    	    		record.annotationObjects = annots;
    				                    	    	},
    				                    	  		fields: [{name: "metatype", width: 100},
    				                    	  		         {name: "name"}]
    				                      		}
    			                      		}
    			                      },
    			                      {name: "created", canEdit: false, width: 80},
    			                      {name: "modified", canEdit: false, width: 80}
    			                      ]
    				   	 });
    Under editorProperties the canvasConstructor is ListGrid. We have two installations. On my sandbox the embedded listgrid (for the annotationObjects filed) appears and works properly. On our deployment installation, instead of an embeded list grid we are seeing an instance of something called 'isc.NestedListEditorItem' in that column.

    None of our code specifically uses this type of field. Under what conditions does this type of field get created?

    Here is the annotationEditorDS DataSource.
    Code:
    <DataSource
        ID="annotationEditorDS"
        serverType="generic">
        <fields>
            <field name="dayportId" title="id" type="text"  length="50"  hidden="true" primaryKey="true" />
            <field name="collectionId" title="collection id" type="text" length="50"  hidden="true" />        
            <field name="created" title="created" type="date" />
            <field name="modified" title="modified" type="date" />
            <field name="note" title="annotation" type="text" length="4000"  required="true" />
            <field name="annotationObjects" title="association list" type="associationMemberDS" multiple="true" />
            <field name="privateTo" title="private to" type="text"  />
            <field name="createdBy" title="created by" type="text" />
            <field name="modifiedBy" title="modified by" type="text"  />
        </fields>
        <serverObject ID="journalAnnotationHandler" lookupStyle="new" 
        		className="com.daylight.port.server.dmi.JournalAnnotationDMI"/>
    </DataSource>
    Note the type field for annotationObjects is the 'associationMemberDS' datasource.

    thanks
    pf

    #2
    This type of item is created by default for editing multiple, complex fields -- IE fields where 'type' is set to some other DataSource, and 'multiple' is true.

    You should be able to override it to use the editor you want by setting 'editorType' on the ListGridField to CanvasItem.
    Let us know if that doesn't get you up and running!

    Thanks

    Comment

    Working...
    X