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
how to change the background color of row depending on condiiton
08/10/2014
22:55
Avatar
mcfarland
Member
Members
Forum Posts: 11
Member Since:
07/10/2014
sp_UserOfflineSmall Offline

Hi,

 

I am new to jqgrid, i have a jqgrid which populates data,one of the column in that grid has drop down for each and every row where user can update the data and click on enter it will save in the database.

only two options in the dropdown one is present and another is unpresent

The idea is that - the record which is updated to unpresent it has to be in green color ( so that users can identify that the record is unpresent.)

 how can i use the below method in my code.

 

afterInsertRow : function(rowid, rdata){
if(condition here) {
 $(”#”+rowid,”#mygrid”).css({'background-image':'url(../js/themes/basic/images/some_bg.jpg)', color: 'red'})
}
..
}

 

here is my code

$(function() {
var lastSelectedId;
$("#list").jqGrid({
url: 'JQGridHandler.ashx',
datatype: 'json',
height: 250,
colNames: ['Description'],
colModel: [
{ name: 'Desc', index: 'Desc', width: 256, stype: 'text', sortable: false, editable: true, edittype: 'select', formatter: 'select', editoptions: { value: "present:Present; unpresent:unpresent"} },

],
rowNum: 10,
loadonce: true,
rowList: [10, 20, 30],
pager: '#pager',
sortname: 'name',
viewrecords: true,
sortorder: 'asc',
gridview: true,
ignoreCase: true,
caseSensitive: false,
rownumbers: true,
reloadAfterSubmit: false,
width: 1024,
jsonReader: {
repeatitems: false
},

caption: 'Update',
editurl: 'JQGridHandler.ashx',
onSelectRow: function(id) {
if (id && id !== lastSelectedId) {
$('#list').restoreRow(lastSelectedId);
$('#list').editRow(id, true);
lastSelectedId = id;
}

},

afterSubmit: function() {

$(this).jqGrid("setGridParam", { datatype: 'json' });
return [true];
alert("returnvalue");
}

});

in ashx file we are calling a stored procedure where it updates the selection ...

21/10/2014
16:56
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

 

1. afterInsertRow is not your solution.

2. afterSubmit as you set is not a grid parameter.

3. You use inlineedit - I suggest you to use aftersavefunc which should be passes as parameter in editRow.

See docs for this purpose.

 

Kind Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
65 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