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
Hide plus image subgrid if no data
04/05/2009
02:44
Avatar
josepk
Member
Members
Forum Posts: 44
Member Since:
16/06/2008
sp_UserOfflineSmall Offline

Hi,

I have a grid with several rows that can have additional data which must be displayed as a subgrid.

The problem is:

If the row hasn't data I want the plus image dissapear.

If it is not possible, I want that if you click to plus image has not effect and there is no load url with empty content.

is it possible?

thanks in advance.

Josep Escofet

05/05/2009
08:55
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

There was a similar post but.

If you have record (field) in the master where you have information about the children in the subgrid you can use afterInsertRow to clear the plus for the subgrid something like (suppose you have field childrecords in colModel)

afterInsertRow: function(rowid, aMasterRow) {
if(parseInt(aMasterRow.childrecords,10) === 0) {
// remove the plus from subgrid
$("td.sgcollapsed","#"+rowid).empty().unbind('click');
}
}
If you do not want to remove the plus just use unbind.

Enjoy

Tony

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.

06/05/2009
01:40
Avatar
josepk
Member
Members
Forum Posts: 44
Member Since:
16/06/2008
sp_UserOfflineSmall Offline

Tanks for the answer,

I don't have the information,this is searched when you click the plus image, but I have the userData an array telling me what row will held information. I am going to try your solution with my userData array.

thanks.

Josep Escofet

06/05/2009
02:18
Avatar
josepk
Member
Members
Forum Posts: 44
Member Since:
16/06/2008
sp_UserOfflineSmall Offline

Hi Tony,

I have tried your solution and it works, but I have a minor problem:

On event : loadComplete: function(){
            isSubgridData = jQuery("#gridGastos").getUserData();

          }

I get an array of true, false elements, one for each row that indicate if there is more info to fetch when user click the image.

The problem is when I use this array into the afterInsertRow event, it says me that isSubridData is not defined.

afterInsertRow: function(rowid, aMasterRow) {
            if (isSubgridData[rowid-1] == "false"){
                $("td.sgcollapsed","#"+rowid).empty().unbind('click');
            }
    },

but if I put : isSubgridData = jQuery("#gridGastos").getUserData();

in the afterInsertRow then it works, but I don't think is 100% correct, becouse I am fetching the array on every row and It is not necesary.

Any idea?

Thanks in Advance.

Josep Escofet

06/05/2009
02:50
Avatar
josepk
Member
Members
Forum Posts: 44
Member Since:
16/06/2008
sp_UserOfflineSmall Offline

Hi Tony,

I have tried your solution in more detail and I realised that in the first time it works correclty, but when the grid is reload with new data, then the first row isnt erase de plus image, but If I put the next it works for the first and next reloades.

rowid-1

$("td.sgcollapsed","#"+rowid-1).empty().unbind('click');

I don't know if it is correct, but it works.

thanks.

Josep Escofet.

06/05/2009
03:08
Avatar
josepk
Member
Members
Forum Posts: 44
Member Since:
16/06/2008
sp_UserOfflineSmall Offline

Rectification,

It don't  work 100% has some strange issues.

$(”td.sgcollapsed”,”#”+rowid).empty().unbind('click');

If I left this solution, then when the grid is reload the image of first row isnt deleted.

I keep on looking for a solution.

Josep Escofet

06/05/2009
04:49
Avatar
josepk
Member
Members
Forum Posts: 44
Member Since:
16/06/2008
sp_UserOfflineSmall Offline

PROBLEM SOLVED.

I have found the problem, in my page I have 2 grids. When you insert rows in the first grid they are saved in the serve.

But in the second grid I load the data from the server, but the data of grid is still loaded and there is a problem with the second grid and images id or something else.

If I clear the data of the first grid after saving on server, all works perfect.

Thanks.

Josep Escofet

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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