Forum


23:46

02/11/2011

I have looked everywhere for an answer to this problem. Hopefully someone here can point me in the right direction.
I have a grid that expands all subgrid (in my case custom html) when the oage is loaded. This works just fine. The problem is when i sort. The sort works fine, but the subgrids dont all expand. it appears that no matter how large the set only the frist half in the sort get expanded. The remaining rows stay collapsed AND the row toggle to expand is inactive meaning i cant even manually expand them. Seems like an odd behavior as it appears the it "Kinda" works.
This is my grid code (4.2.0)
buildNotesGrid: function (noteType, sequence) {
$.getJSON("/Grids/Note/" + noteType + "/" + sequence, null, function (data) {
var notesPage = ("#notes_index"),
dataRows = data.rows,
notesGrid = $('#note_grid'),
dataRowLength = dataRows.length,
notesGridContainer = $(notesPage).find("#gbox_note_grid");
if (dataRowLength > 0) {
$(notesGridContainer).show();
notesGrid.jqGrid({
datatype: 'clientSide',
loadonce: true,
sortable: true,
sortorder: 'asc',
colNames: ['NoteId', 'Type', 'Sub Type', 'ID', 'Created Date', 'Created By', 'Modified Date', 'Modified By', 'Visible to Client'],
colModel: [
{ name: 'Id', index:'Id', hidden: true, classes: 'note_id', title: false, sortable: false, key: true },
{ name: 'NoteTypeValue', index: 'NoteTypeValue', classes: 'note_type', title: false, sortable: false },
{ name: 'SubType', index: 'SubType', classes: 'note_sub_type', title: false, sortable: true, sorttype: 'text' },
{ name: 'Key1', index: 'Key1', classes: 'key_1', title: false, sortable: false },
{ name: 'CreatedDate', index: 'CreatedDate', sortType: 'date', classes: 'created_date', sortable: true, sorttype: 'date', title: false, formatter: json.formatJsonDate },
{ name: 'CreatedByUsername', index: 'CreatedByUsername', classes: 'created_by_username', title: false, sortable: true, sorttype: 'text' },
{ name: 'LastUpdatedDate', index: 'LastUpdatedDate', sortType: 'date', classes: 'last_updated_date', title: false, sortable: true, sorttype: 'date', formatter: json.formatJsonDate },
{ name: 'LastUpdatedByUsername', index: 'LastUpdatedByUsername', classes: 'last_updated_username', title: false, sortable: true, sorttype: 'text' },
{ name: 'IsVisibleToClient', index: 'IsVisibleToClient', classes: 'visible_to_client', title: false, sortable: true, sorttype: 'int', formatter: notes.setVisibleCell, hidden: data.isCurrentUserClient }
],
width: "100%",
height: "100%",
altRows: true,
rowNum: 500,
subGrid: true,
subGridOptions: {
expandOnLoad: true,
reloadOnExpand: false
},
subGridRowExpanded: function (pID, id) {
var subGridContent = $(this).find("#" + pID),
row = $(this).find("#" + id),
noteId = parseInt(row.find("td").first().next().html()),
noteType = row.find("td.note_type").html(),
firstTd = subGridContent.parents("tr").first().find("td").first(),
secondTd = firstTd.next(),
expandedColSpan = parseInt(secondTd.attr("colspan")) + 1;
firstTd.remove();
secondTd.attr("colspan", expandedColSpan);
notes.loadNoteView(noteId, row, subGridContent, noteType);
},
loadComplete: function () {
notes.resizeGrid();
// toolTips.initToolTips();
},
gridComplete: function () {
var headerToggle = $("#note_grid_subgrid"),
expandToggle = $("<div id='expand_all_toggle' class='expanded'></div>");
headerToggle.html("");
headerToggle.append(expandToggle);
grid.expandAllToggle();
$("tr.jqgrow:odd").addClass("ui-priority-secondary");
}
});
for (var i = 0; i < dataRowLength; i++) {
var dataRowAtIndex = dataRows[i];
notesGrid.jqGrid('addRowData', dataRowAtIndex.id, dataRowAtIndex);
}
notesGrid.fluidGrid({ example: notesPage });
$(window).resize(function () {
notesGrid.fluidGrid({ example: notesPage });
});
}
else {
$(notesGridContainer).hide();
$(notes.newNoteToggleId).click();
}
});
}
I have alos noticed and it may be a possibility. It seems the sort it only reloading the subgrids for HALF, so im wondering if there is some kind of count being made that doesnt take into consideration the subgrids since each subgrid is not a child of the triggering row, but a sibling. so if some kind of count was being stored without the subgrid count then in a event triggered somthing after based on the count it would be HALF off.
Im just not sure where to look or how to solve this. Maybe one of the plugin authors could chime in?
Thanks
00:53

24/06/2009

Have you been able to figure this out? I get the same issue, and it happens on the first load and my first loaded list is a sorted result. Exactly the same problem as you described - only the first half of the subgrid expanded, and the rest of the rows can't be expanded. By checking with firebug, I can see the subgrid html/javascript got messed up.
Thanks very much if you could provide some info about how to fix this issue.
Most Users Ever Online: 715
Currently Online:
49 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