PDA

View Full Version : disable row in grid



shahdollie
11 Oct 2010, 3:21 PM
hi everyone

Is it possible to disable a row in grid?

I want to disable a row in a way change its background to grey, not to allow drag operation, make it unselectable, etc.

Is this possible with grid? Or any other extjs component?

Regards

shahdollie
11 Oct 2010, 4:58 PM
I found many threads but didn't find a solution.

According to jsakalos in following thread we can mask row element and then no need to overwrite any other operation:
http://www.sencha.com/forum/showthread.php?39134-Disable-only-one-row-in-a-grid&highlight=disable+row+grid

Can anybody tell how to mask a row?

Right now i m able to do following things:

- make appearance of row as disabled using addRowClass(rowIndex, 'x-item-disabled');
- preventing row from it being selected

Can't do following:

- stop mouseover on disabled row (as mouseover changes background)
- stop dragging disabled row

Can anybody help PLEASE ???
Regards

Condor
12 Oct 2010, 3:09 AM
1. Make row grey: Write a getRowClass method to add a css class to specific rows.
2. Disallow row drag: Automatically happens when the row unselectable (see #3).
3. Make row unselectable: Return false from the beforerowselect event for specific rows.
4. Prevent mouseover: You can't prevent mouseover, but you can use the css class assigned in #1 to disable the row highlight for that row.

shahdollie
12 Oct 2010, 2:20 PM
Hi thanks alot for replying.

Sorry i was mistaken. The disabled row in grid was not being dragged.

I didn't understood #4. i know how to assign class using getRowClass but how can i use that same class to disable the row highlighting???

Regards

Condor
12 Oct 2010, 11:54 PM
With the getRowClass you are assigning a class to the row <div>.

Create a css rule for this class to counteract the effect of the class that is assigned on mouseover (x-grid3-row-over).

solovieff13
17 Nov 2010, 7:10 AM
Hi, Condor. What should I do, if I want to disable all visible rows except one on some event?
In my application I have nested grid and I want to disable all rows except the row which is currently expanded.

Condor
17 Nov 2010, 10:51 AM
Use the same methods as described above.

If your rules for disabling rows changes you will have to call grid.getView().refresh().