Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
igGrid 16.1 - Complex Objects & Exporting
posted

I have the following grid below, for this purpose assume both the state / user api will return an id & name.   I am unable to export this grid however, as I get the following error when attempting it.   Are we able to export grids with complex objects?  If so, could you provide an example?

infragistics.excel.js:79 Uncaught TypeError: a.getType is not a function$c.a0 @ infragistics.excel.js:79$c.ay @ infragistics.excel.js:79$c.ao @ infragistics.excel.js:79$c._d1 @ infragistics.excel.js:49$c.setCellValue @ infragistics.excel.js:48$.ig.GridExcelExporter.$.ig.GridExcelExporter.Class.extend._exportCell @ infragistics.gridexcelexporter.js:23$.ig.GridExcelExporter.$.ig.GridExcelExporter.Class.extend._exportDataSegmentRow @ infragistics.gridexcelexporter.js:23$.ig.GridExcelExporter.$.ig.GridExcelExporter.Class.extend._exportDataSegment @ infragistics.gridexcelexporter.js:23(anonymous function) @ infragistics.gridexcelexporter.js:23

    $("#grid").igGrid({
        virtualization: false,
        primaryKey: "id",
        responseDataKey: "value",
        autoGenerateColumns: false,
        autoGenerateLayouts: false,
        localSchemaTransform: true,
        renderCheckboxes: true,
        columns: [{
            // note: if primaryKey is set and data in primary column contains numbers,
            // then the dataType: "number" is required, otherwise, dataSource may misbehave
            headerText: "Id", key: "id", dataType: "number"
        },
		{
		    headerText: "Year", key: "year", dataType: "string"
		},
		{
		    headerText: "State", key: "state", dataType: "object", width:250, mapper: function (record) { return record.state.name; }
		},
		{
		    headerText: "User", key: "user", dataType: "object", width:250, mapper: function (record) {
		        if (record.user != null)
		        { return record.user.name; }
		        else
		        { return null; }
		    }
		}
        ],
        width: "500",
        features: [
	    {
	        name: "Updating",
	        enableAddRow: false,
	        enableDeleteRow: false,
	        editMode: "cell",
	        columnSettings: [
	            {
	                columnKey: "user",
	                editorType: "combo",
	                editorOptions: {
	                    dataSource: "/api/usersapi/",
	                    textKey: "name",
	                    valueKey: "id",
                        mode: "editable"
	                }
	            },
                {
                	columnKey: "state",
                	editorType: "combo",
                    disabled: true,
                	editorOptions: {
                	    dataSource: "/api/statesapi/",
                	    textKey: "name",
                	    valueKey: "id",
                	    mode: "dropdown"
                	}
                },
                { columnKey: "id", editorOptions: { disabled: true } },
                { columnKey: "year", editorOptions: { disabled: true } }
                
	        ]
	    },
            {
                name: "Hiding",
                columnSettings: [
                    { columnKey: "id", allowHiding: false, hidden: true },
                    { columnKey: "year", allowHiding: false, hidden: true }
 
                ]
            },
 
        ]
 
 
    });
Parents Reply
  • 190
    posted in reply to Hristo Anastasov

    Hristo,

    In your example: http://jsfiddle.net/1qgwjL2h/1/   if i switch the last line of data to the following:   

                            { 'ProductID': 43, 'Name': 'Odit ut quo minus.', 'ProductNumber': 1083007847, "InStock": false, "Quantity": 0, "User": null }


    it no longer seems to work.   This would be more representative of my data as the user has not yet been selected:

    {
    "id": 60,
    "year": 2017,
    "state": {
    "id": 2,
    "abbreviation": "AK",
    "escheatmentname": "STATE OF ALASKA",
    "name": "Alaska",
    "territory": false,
    "updateUser": "CORP\\XYZ",
    "updateTime": "2016-06-03T15:04:37.503"
    },
    "user": null
    }

Children