Take the 2-minute tour ×

I'm using Flexigrid to display paginated data and it works very well. Now I need to add links to all the rows ("edit", "view", "delete") and honestly I have no idea how to proceed with it. Is there something that I could use right out of the box?

The basic idea is to have an additional column with small icons for those 3 links and not to have the toolbar at the top.

Any ideas?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

I've got it figured out :)

The trick is to simply put the link directly in the data returned by script. For example this will create a row with the first column containing the links in question:

List<Object> rows = new List<Object>();
foreach (var item in results) {
rows.Add(new { 
	id = item.ID,
	cell = new string[] { 
		String.Format("<a href='/Account/View/{0}'>view</a>&nbsp;<a href='/Account/Edit/{0}'>edit</a>", item.ID), 
var result = new { page = page, total = rowcount, rows = rows };
return Json(result);
share|improve this answer

I did not like the fact that the "presenter" which builds the grid's data injects markup. I added this little extension which is run on the "onSuccess" event. It transforms the default column representation into a link.

(function ($) {
    $.fn.flexLinkColumn = function (colIndex, url) {
        if (colIndex === undefined || url === undefined)
            throw "flexLinkColumn requires colIndex and url";

        if ($(this).closest('div.flexigrid').length === 0)
            throw "flexiLinkColumn only operates on flexilink grids.";

        $(this).find('tr').each(function (index, tr) {
            var rowId = $(tr).attr('id');
            var itemId = rowId.substring(3);
            var itemUrl = url + (itemId ? "/" + itemId : "");

            var div = $(tr).find('td').eq(colIndex).find('div');
            var text = $(div).text();
            $(div).html('<a href="' + itemUrl + '">' + text + '</a>');
share|improve this answer

For Rails:

Add like below

return_data[:rows] = @countries.collect{|l| { :id => l.id, :cell=>[ 
'%a :href=>'javascript:void(0);'#{l.client_cont_person}', // normal html link

share|improve this answer

Your Answer


