jQuery UI Widgets Forums Grid Set Hyperlink in Cell with data loading from CSV

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 9 years, 11 months ago.

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

  • chahit93
    Participant

    I created jqxgrid with data loading from my csv. I wish to show url in last column but data csv file i have, has urls somewhere like “www.google.com” (with double quotes)and somewhere like http://www.google.com (without double quotes). So How can I set link in cell by trimming wherever double quotes are there.

    Also some values in data csv file have garbage value (“no-name”) for column “NAME”, so what i want to do whenever name is “no-value” cell in column “NAME” should have cell value as “STUDENT”

    Code I made is :
    $(document).ready(function () {
    var hght=window.innerWidth;
    var url = ‘mydata.csv’;
    var source =
    {
    datatype: “csv”,
    datafields: [
    { name: ‘url’, type: ‘string’ },
    { name: ‘name’, type: ‘string’ },
    { name: ‘age’, type: ‘string’ },
    { name: ‘category’, type: ‘string’ }

    ],
    url: url
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxgrid”).jqxGrid(
    {
    sortable: true,
    autoheight: true,
    autorowheight: true,
    source: dataAdapter,
    columnsresize: true,
    columns: [
    { text: ‘Name’, datafield: ‘name’, width: 250},
    { text: ‘Age’, datafield: ‘age’, width: 300 },
    { text: ‘Category’, datafield: ‘category’ },
    { text: ‘Link’, datafield: ‘url’}
    ],
    width:hght*0.98
    });
    });

    Hope you will help soon


    Dimitar
    Participant

    Hello chahit93,

    Here is how to implement a link column in a jqxGrid: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/customcolumn.htm?arctic. For your various requirements you can use the JavaScript String methods and jQuery to trim and replace the loaded values with the ones you require.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.