This is a migrated thread and some comments may be shown as answers.

[Solved] Change cell content with javascript

0 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
JULIA
Top achievements
Rank 1
JULIA asked on 07 Jul 2010, 07:09 AM
Hello,

is there a way to change the cell content after a link click? i want delete the link from dom and instead add a label.

<% Html.Telerik().Grid( Model )  
    .Name( "dataGrid" )  
    .DataKeys( keys => keys.Add( k => k.PersonId) )  
    .Columns( c => 
    {  
        c.Bound( p => p.PersonId).Width( 80 ).Title( "Id" ).Width( 100 );  
        c.Bound( p => p.FullName ).Title( "Name" ).Width( 150 );  
        c.Template( p => 
        {%> 
            <href="#">Add</a> 
        <%} );  
    } )  
    .Sortable()  
    .Render(); %> 

 $(function () {  
        $('#dataGrid tr:has(td) td a').click(function (e) {  
            var row = $(this).parent().parent();  
            var grid = $(row).parents('.t-grid').data('tGrid');  
            var data = $('#dataGrid').data[$(grid.$tbody[0].rows).index(row)];  
 
            // data is always null???  
 
            var id;  
            for (x in grid.dataKeys)  
                id = data[x];  
 
            // javscript service call with id  
 
            // delete the link and add a label  
        });  
    }); 

best regards
Tags
Grid
Asked by
JULIA
Top achievements
Rank 1
Share this question
or