sree
sree

Reputation: 535

SlickGrid | Escaping Space | Formatter

I am using SlickGrid formatter.Below is my code

var columns = [{
    id: "name", 
    name: "name", 
    field: "name", 
    sortable: true,
    formatter: linkFormatter1
},];

var linkFormatter1 = function ( row, cell, value, columnDef, dataContext ) {
    return "<a href=javascript:check1(\'" + dataContext['name'] + "\') class='listLink'>" + value + '</a>';
};

function check1(data){
    alert(data);
} 

Consider my case where 'name' field is "Routing Type".It considers only 'Routing'.It omits Space.How can i escape single space.Let me know asap.thanks in adv.!

Upvotes: 0

Views: 581

Answers (1)

clav
clav

Reputation: 4251

The problem is that you're not wrapping your href with quotes. Try this:

var linkFormatter1 = function ( row, cell, value, columnDef, dataContext ) {
    return '<a href="javascript:check1(\'' + dataContext['name'] + '\');" class="listLink">' + value + '</a>';
}

Upvotes: 1

Related Questions