Information about 'target'


#1

Does documentation exist about the concept of “target”? Is there a way that links target to datasource?


#2

Could you please provide more context? I’m not sure what you mean by “target”


#3

I have the kendogrid component:

"behavior": {
            "$ .export-csv": {
                "click": {
                    "type": "LCI.EnterpriseExportCSV",
                    "target": "FacilityListTabs.FacilityListView",
                    "displayName": "label",
                    "dataField": "field",
                    "exportFileName": "Facilities",
                    "exportAll": true
                }
            }
        }

And I must export all data refer to target’s name. But I have the problem that I don’t export plus than 25 items. Does a solution exist for it?

I send you the function about the export:

C3.define('C3.action.LCI.EnterpriseExportCSV', {
    extend: 'C3.action.Action',

    config: {
        /**
         * @cfg {C3.view.Component} target The Component or array of Components clear
         */
        target: null,

        /**
         * @cfg {String} displayName The header name in csv
         */
        displayName: 'label',

        /**
         * @cfg {String} dataField The field name in data source
         */
        dataField: 'field',

        /**
         * If we want to export all items in the collection.
         * @type {Boolean}
         */
        exportAll: false,

        /**
         * @cfg {String} exportFileName THe csv file name
         */
        exportFileName: 'dataExport'
    },

    /**
     * @inheritDoc
     */
    dispatch: function (component, args) {
        var dataField = this.get('dataField'),
            displayName = this.get('displayName'),
            target = component.findComponent(this.get('target')),
            columns = target.get('columns.items') || target.get('columns'),            
            dataSource = target.getData('collection') || target.get('collection'),     
            records, csv, columnHeader = [], columnsField = [], csvData = [],
            exportFileName = C3.script.helpers.appendCSVSuffix(this.get('exportFileName'));

        if (target instanceof C3.view.KendoGrid) {
            _.each(columns, function (column) {
                columnsField.push({
                    field: column[dataField],
                    format: column.format,
                    exportRaw: column.exportRaw
                });
                columnHeader.push(column[displayName]);
            });
        } else {
            _.each(columns, function (column) {
                columnsField.push({
                    field: column.get(dataField),
                    format: column.get('format')
                });
                columnHeader.push(column.get(displayName));
            });
        }

        if (dataSource.state === 'loaded') {
            csvData.push(columnHeader.join(';'));
            if (this.get('exportAll')) {
                records = dataSource.get('items');
            } else {
                records = dataSource.getSelected();
            }
            _.each(records, function (record) {
                var row = [];
                _.each(columnsField, function (fielddata) {
                    var field     = fielddata.field,
                        format    = fielddata.format,
                        value     = record.getData(field),
                        exportRaw = fielddata.exportRaw;
                    if (C3.util.exists(value) && format && !exportRaw) {
                        value = C3.script.helpers.call(format, value);
                    }
                    if (_.isString(value)) {
                        value = value.replace(/\n/g, ' ');
                        if (value.indexOf(';') > -1) {
                            value = '"' + value + '"' ;
                        }
                    }
                    row.push(value);
                });
                csvData.push(row.join(';'));
            });
            csv = new Blob([csvData.join('\n')], { type: 'text/csv;charset=utf-8' });
            saveAs(csv, exportFileName);
        }
    }
});

#4

Probably related to my answer here Info about concept of limit