Forum


18:59

23/09/2011

Hi,
I am using the following to disable a cell in :loadComplete method
grid.jqGrid(‘setCell’, id, ‘amount’, '', ‘not-editable-cell’);
How do I re-enable this cell?, I know I need to remove the class ‘non-editable-cell’ added above but i dont see any option to do this
I have tried the above call with setting the class to ‘ui-state-active’ also tried using getCell(…).removeClass(‘not-editable-cell’) but that retrieves the value and not the Cell Object,
Would really appreciate an answer for this
Thanks
13:14

Moderators
30/10/2007

Hello,
Yes this is true, there is no build in way to do this, but I think it is not so difficult.
Let me explain:
What you use in setCell to add the class ‘not-editable-cell’?
1. the id
2. the name of the column.
Having this and jQuery it is easy to remove the class. Why?
1. We know the id element from which to remove the class of some child.
2. We know the name of the column – i.e its position of the td in the table row
Suppose the amount have the position 2 (count from 0) you can easy do:
jQuery("#"+id+" td:eq("+colpos+")" ).removeClass(‘not-editable-cell’);
Generally speaking you can get the colpos using this script:
var colModel = jQuery("#gridid").jqGrid('getGridParam','colModel');
var colpos = null;
$(colModel).each(function(i){
if (this.name == 'amount') {
colpos = i;return false;
}
});
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.
12:58

23/09/2011

tony said:
Hello,
Yes this is true, there is no build in way to do this, but I think it is not so difficult.
Let me explain:
What you use in setCell to add the class ‘not-editable-cell’?
1. the id
2. the name of the column.
Having this and jQuery it is easy to remove the class. Why?
1. We know the id element from which to remove the class of some child.
2. We know the name of the column – i.e its position of the td in the table row
Suppose the amount have the position 2 (count from 0) you can easy do:
jQuery("#"+id+" td:eq("+colpos+")" ).removeClass(‘not-editable-cell’);
Generally speaking you can get the colpos using this script:
var colModel = jQuery("#gridid").jqGrid('getGridParam','colModel');
var colpos = null;
$(colModel).each(function(i){
if (this.name == 'amount') {
colpos = i;return false;
}
});Regards
Hi Tony,
Yes have basically introduced this idea, but thought it should be built in
Thanks
13:00

23/09/2011

One more thing,
I want to restrict the data type entered into this cell
so i found a char restriction plugin that i have working for a text input and try the following
with amountCellWithData being a dummy class added so that i can easily retrieve the cells
$(".amountCellWithData").each(function() {
$(this).charRestriction({limit_to:"numeric"});
})
but does not work in the treegrid – any ideas on a surefire way to implement this or similar?
Thanks
Most Users Ever Online: 715
Currently Online:
61 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66