Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Add edit icon to ClientSide data array
19/08/2009
21:48
Avatar
sagana
Australia
Member
Members
Forum Posts: 16
Member Since:
20/08/2009
sp_UserOfflineSmall Offline

I want Edit and Delete icons in each row of the grid. I have this working when the data is returned from MySQL using json but not when the data is in a clientside array. Using the loadComplete method, nothing displays in the 'Actions' column. Creating the icons in the relevant column in each line of the array displays the icons correctly but halts the programme and does nothing when they are clicked on. Code as follows:-

jQuery(document).ready(function(){
    jQuery("#trlist").jqGrid({
        datatype: 'clientSide',
        colNames:['Actions','Row','Date', 'Acc to Dr','Acc to Cr','Reference','Amount','Tax','Description'],
        colModel :[
           {name:'act',index:'act', width:50,sortable:false},
           {name:'id',index:'id', key:true, width:55, sorttype:'int'},
           {name:'ddate',index:'ddate', width:90, sorttype:'date', datefmt:'d-m-Y'},
           {name:'acc2dr',index:'acc2dr', width:180,sortable:false},
           {name:'acc2cr',index:'acc2cr', width:180,sortable:false},
           {name:'ref',index:'ref', width:70},
           {name:'amount',index:'amount', width:60,align:'right',sortable:false},
           {name:'tax',index:'tax', width:60,align:'right', sortable:false},
           {name:'descript',index:'descript', width:180, sortable:false}
        ],
        pager: jQuery('#trpager'),
        rowNum:10,
        viewrecords: true,
        imgpath: '../includes/jqgrid/themes/coffee/images'
        
    });
});

Code here populates the required variables, then:-

    l_id++;
    var be = '<img src="../images/edit.png" title="Edit" onclick="javascript:edittr('+l_id+')" >';
    var se = '<img src="../images/delete.png" title="Delete" onclick="javascript:deltr('+l_id+')" >';

    var line2add = {
        act: be+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+se,    
        id: l_id,
        ddate: ddate,
        acc2dr: a2dr,  
        acc2cr: a2cr,  
        ref: reference,
        amount: amount,
        tax: tax,
        descript: description}
        
    jQuery("#trlist").addRowData(l_id,line2add,"first");

The rest of each row in the grid looks fine. I would appreciate any assistance on this.

20/08/2009
19:02
Avatar
sagana
Australia
Member
Members
Forum Posts: 16
Member Since:
20/08/2009
sp_UserOfflineSmall Offline

act: be+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+se,    works although I see no reason why the single quote didn't.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
46 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information