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
Disabling and reEnabling Cells in a jqGrid
23/09/2011
18:59
Avatar
leinad
Member
Members
Forum Posts: 4
Member Since:
23/09/2011
sp_UserOfflineSmall Offline

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

26/09/2011
11:16
Avatar
leinad
Member
Members
Forum Posts: 4
Member Since:
23/09/2011
sp_UserOfflineSmall Offline

Hi,

Does anyone have an answer for this, I was hoping it was a straightforward action,

But it doesnt seem it can easily be done in jqgrid

Thanks

26/09/2011
13:14
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

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.

11/10/2011
12:58
Avatar
leinad
Member
Members
Forum Posts: 4
Member Since:
23/09/2011
sp_UserOfflineSmall Offline

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

11/10/2011
13:00
Avatar
leinad
Member
Members
Forum Posts: 4
Member Since:
23/09/2011
sp_UserOfflineSmall Offline

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

Forum Timezone: Europe/Sofia

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.com

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

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information