Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts

  • lsantos
    Participant

    Hi.

    Here is the requested code:

    var source = {
    datatype: “local”,
    ddatafields: [
    { name: ‘ClientName’, type: ‘string’ },
    { name: ‘LocDesig’, type: ‘string’ },
    { name: ‘Address’, type: ‘string’ },
    { name: ‘City’ , type: ‘string’},
    { name: ‘Telephone’ , type: ‘string’},
    { name: ‘LongitudString’, type: ‘string’ },
    { name: ‘LatitudeString’, type: ‘string’ },
    { name: ‘State’, type: ‘string’ },
    { name: ‘StateStr’, type: ‘string’ },
    { name: ‘IMEI’, type: ‘string’ },
    { name: ‘MotivoManutencao’, type: ‘string’ }
    ],
    pagesize: 20,
    pager: function (pagenum, pagesize, oldpagenum) {
    // callback called when a page or page size is changed.
    }
    };

    var dataAdapter = new $.jqx.dataAdapter(source, {
    downloadComplete: function (data, status, xhr) { },
    loadComplete: function (data) { },
    loadError: function (xhr, status, error) { }
    });

    Best regards,

    Luis Santos


    lsantos
    Participant

    Yes, the problem remains in the 3.0.2 version.

    Description of the example:

    Code to format the grid:

    $(“#jqxgrid”).jqxGrid({
    width: ‘100%’,
    height:’100%’,
    source: dataAdapter,
    theme: ‘classic’,
    pageable: true,
    autoheight: false,
    altrows: true,
    enabletooltips: false,
    editable: false,
    selectionmode: ‘none’,
    filterable: true,
    sortable: true,
    columnsresize: true,
    pagesizeoptions: [’20’, ’50’, ‘100’, ‘200’, ‘300’, ‘400’, ‘500’],
    autoshowfiltericon: true,
    ready: function () {
    //addfilter();
    var localizationObject = {
    filterstringcomparisonoperators: [‘Contains’, ‘Does Not Contain’],
    // filter numeric comparison operators.
    filternumericcomparisonoperators: [‘Less Than’, ‘Greater Than’],
    // filter date comparison operators.
    filterdatecomparisonoperators: [‘Less Than’, ‘Greater Than’],
    // filter bool comparison operators.
    filterbooleancomparisonoperators: [‘Equal’, ‘Not Equal’],
    pagergotopagestring: ‘Go to page:’,
    pagershowrowsstring: ‘Show rows:’,
    pagerrangestring: ‘ of ‘,
    pagernextbuttonstring: ‘next’,
    pagerpreviousbuttonstring: ‘previous’,
    sortascendingstring: ‘Sort Ascending’,
    sortdescendingstring: ‘Sort Descending’,
    sortremovestring: ‘Remove Sort’,
    groupbystring: ‘Group By this column’,
    groupremovestring: ‘Remove from groups’,
    decimalseparator: ‘.’,
    thousandsseparator: ‘,’,
    filterclearstring: ‘Clear’,
    filterstring: ‘Filter’,
    filtershowrowstring: ‘Show rows where:’,
    filterorconditionstring: ‘Or’,
    filterandconditionstring: ‘And’,
    groupsheaderstring: ‘Drag a column and drop it here to group by that column’,
    emptydatastring:’No data to display’,
    patterns: {
    // short date pattern
    d: ‘dd/MM/yyyy’
    }
    }

    $(“#jqxgrid”).jqxGrid(‘hidecolumn’, ‘DepId’);
    $(“#jqxgrid”).jqxGrid(‘localizestrings’, localizationObject);
    },
    updatefilterconditions: function (type, defaultconditions) {
    var stringcomparisonoperators = [‘CONTAINS’, ‘DOES_NOT_CONTAIN’];
    var numericcomparisonoperators = [‘LESS_THAN’, ‘GREATER_THAN’];
    var datecomparisonoperators = [‘LESS_THAN’, ‘GREATER_THAN’];
    var booleancomparisonoperators = [‘EQUAL’, ‘NOT_EQUAL’];
    switch (type) {
    case ‘stringfilter’:
    return stringcomparisonoperators;
    case ‘numericfilter’:
    return numericcomparisonoperators;
    case ‘datefilter’:
    return datecomparisonoperators;
    case ‘booleanfilter’:
    return booleancomparisonoperators;
    }
    },

    altrows: true,
    columns: [
    { text: ‘Client’, dataField: ‘ClientName’, editable: false,cellsalign: ‘center’ , width: 200, type: ‘string’ },
    { text: ‘Local’, dataField: ‘LocDesig’,editable: false, cellsalign: ‘left’ , type: ‘string’, width:300 },
    { text: ‘Address’, dataField: ‘Address’,editable: false, cellsalign: ‘left’ , width: 200, type: ‘string’ },
    { text: ‘City’, dataField: ‘City’,editable: false, cellsalign: ‘left’, width: 150, type: ‘string’ },
    { text: ‘Telephone’, dataField: ‘Telephone’,editable: false, cellsalign: ‘center’, width: 150, type: ‘string’ },
    { text: ‘Latitude’, dataField: ‘LatitudeString’,editable: false, cellsalign: ‘center’, width: 100, type: ‘string’ },
    { text: ‘Longitude’, dataField: ‘LongitudString’,editable: false, cellsalign: ‘center’, width: 100 , type: ‘string’},

    { text: ‘Status’, dataField: ‘StateStr’,editable: false, cellsalign: ‘center’, width: 120, type:’string’ },
    { text: ‘Maintenance Reason’, dataField: ‘MotivoManutencao’,editable: false, cellsalign: ‘left’,width: 150, type:’string’}

    ]

    });

    Code to load data:

    var jsonText = JSON.stringify({ id: id, code: clienteCode, mes: mes, ano:ano, cultura:cultura });
    $.ajax({
    type: ‘POST’,
    dataType: ‘json’,
    async: true,
    url: ‘/ServiceReports.asmx/’+tipo,
    data : jsonText,
    cache: false,
    contentType: ‘application/json; charset=utf-8’,
    success: function (data) {
    source.datatype = “json”;
    source.localdata = data.d;

    $(“#jqxgrid”).jqxGrid(‘updatebounddata’);
    ResizeGrid();
    $(“#jqxgrid”).jqxGrid(‘updatebounddata’);

    },
    error: function (err) {

    }
    });

    Code to export data to excel:

    $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘xls’, exportname);

    Phone number in the JSON object:

    “Telephone”: “+61439109223”,

    Phone number in the excel file:

    12/13/1971

    Note: For “Telephone”: “+61(4)39109223” in the JSON object it works fine in excel

    Luis Santos

Viewing 2 posts - 1 through 2 (of 2 total)