jQuery UI Widgets › Forums › Grid › Set Hyperlink in Cell with data loading from CSV
Tagged: Cell, cellsrenderer, column, data, grid, href, hyperlink in jqxgrid, jqxgrid, Link, linkrenderer, process data in cell jqxgrid
This topic contains 1 reply, has 2 voices, and was last updated by Dimitar 9 years, 11 months ago.
-
Author
-
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
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,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.