When I open up the row, it does open up, but the icon "+" doesn't change to "-". I can collapse the row. The only problem is that icon image doesn't change.
Below is my code. The idea is when a user clicks "Submit" grid gets reloaded. So when it happens 2nd time, the problem occurs.
$( "#btnSubmit" ).click(function() {
LoadGrid();
});
function LoadGrid()
{
var columnModel = [
{title: "", minWidth: 27, width: 27, type: "detail", resizable: false, editable:false, dataIndx:"CollapseID" },
{title:"ID", dataIndx: "ID", hidden:true},
{title:"Plant ", width:200, dataType:"string", align:"right", className:'grid-col', editable:true},
{title:"Current status", width:200, dataType:"string", align:"right", className:'grid-col', editable:false}
];
var dataModel = {
location: "remote",
sorting: "local",
dataType: "JSON",
method: "POST",
recIndx: "ID",
rPPOptions: [1, 10, 20, 30, 40, 50, 100, 500, 1000],
getUrl: function ()
{
var filters = {'name': $("#txName").val()
} ;
return {
url: "/services/svc_Search.php",
data: { dataBuffer: filters }
};
},
getData: function (dataJSON)
{
var data = dataJSON.DataArray;
return { curPage: 1, totalRecords: 1, data: data };
}
};
var $gridMain = $("#grid_array").pqGrid({
dataModel: dataModel,
recIndx: "ID",
showTitle: false,
showBottom: false,
collapsible:false,
scrollModel: {pace: 'fast', horizontal: false},
flexHeight:true,
flexWidth:true,
sortable:true,
columnBorders:false,
editModel: {clicksToEdit: 1, saveKey: 13},
toolbar: {
cls: 'pq-toolbar-export',
items: [{
type: 'button',
label: "Excel",
icon: 'ui-icon-document',
listeners: [{
"click": function (evt) {
$("#grid_array").pqGrid("exportCsv", { url: "/DownloadGrid.php" });
}
}]
}]
},
//editable: false,
colModel: columnModel,
wrap: false,
hwrap: false,
numberCell: { show: false },
resizable: true,
freezeCols: 1,
freezeRows: 0,
selectionModel: {type: 'row', mode: 'multiple'},
detailModel:
{
cache: true,
collapseIcon: "ui-icon-plus",
expandIcon: "ui-icon-minus",
init: function (ui)
{
var rowData = ui.rowData,
plantID = rowData[1];
//make a deep copy of gridDetailModel
var objCopy = $.extend(true, {}, gridDetailModel);
objCopy.dataModel.url = "/services/svc_PlantStatusHistory.php?PlantID=" + plantID;
objCopy.dataModel.error = function ()
{
$gridMain.pqGrid("rowInvalidate", {rowData:rowData});
};
var $grid = $("<div></div>").pqGrid(objCopy);
return $grid;
}
}
});
var gridDetailModel =
{
dataModel: {
location: "remote",
sorting: "local",
dataType: "JSON",
method: "GET",
getData: function (dataJSON)
{
return { data: dataJSON.DataArray };
}
},
colModel: [
{ title: "Date", width: 100, dataType: "date"},
{ title: "Status", width: 200},
{ title: "Note", width: 200}
],
editable: false,
freezeCols: 0,
flexHeight: true,
flexWidth: true,
numberCell: { show: false },
showTop: false,
showBottom: false
};
$("#grid_array").pqGrid("refreshDataAndView");
}