Hi ,
I am using list grid and set dataPageSize: 20 in the list . All pagination with grid was working fine .
But when I tried to use transformresponse with RestDataSource paging int List grid is lost . Am i doing something wrong with following code , please suggest :
isc.RestDataSource.create({
ID: "msgListdataSource",
dataFormat: "xml",
showPrompt: false,
showPrompt: false,
fetchDataURL : "<%= request.getContextPath() %>/MsgCenterSmartClient/MsgCenterSmartClient_getMessages.action",
updateDataURL:"<%= request.getContextPath() %>/MsgCenterSmartClient/MsgCenterSmartClient_updateReadFlag.action",
removeDataURL:"<%= request.getContextPath() %>/MsgCenterSmartClient/MsgCenterSmartClient_deleteMessage.action",
fields: [
{name: "messageid", type: "text", primaryKey: true},
{name: "priority", type: "text"},
{name: "category", type: "text"},
{name: "type", type: "text"},
{name: "subject", type: "text"},
{name: "receiveddatestring", type: "text"},
{name: "expirydate", type: "text"},
{name: "smstext", type: "text"},
{name: "attachmentnames", type: "text"},
{name: "singleattachmentid", type: "text"},
{name: "readflag", type: "text"},
{name: "icon", type: "image"},
{name: "expiryflag", type: "text"},
{name: "todaysmsg", type: "text"}
],
transformResponse : function (dsResponse, dsRequest, xmlData) {
lastRecievdDate = '' + isc.XMLTools.selectString(xmlData, "/response/lastrecieveddate");
if(lastRecievdDate == 'null') {
lastRecievdDate = '' + isc.XMLTools.selectString(xmlData, "/response/data/record/lastrecieveddate");
}
}
});
isc.ListGrid.create({
ID:"messageList",
width:"100%",
height:"100%",
selectionType: "single",
wrapCells:true,
sortDirection:"ascending",
fixedRecordHeights:true,
showAllRecords: false,
alternateRecordStyles:true,
dataSource: "msgListdataSource",
dataPageSize: 20,
leaveScrollbarGap: false,
loadingMessage: "<wl:message nlsKey='msgcenter.text.Loading' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>",
fields: [
{name: "icon", title: " ", summaryTitle : "<wl:message nlsKey='msgcenter.text.ATTACHMENT_SUMMARY' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>", icon: "<%= request.getContextPath() %>/images/attachment.gif", iconAlign: "center",
width: "45", type: "image", imageURLPrefix: "<%= request.getContextPath() %>/images/",
imageURLSuffix: ".gif", canSort: false, showHover: true, canHover: true,
hoverHTML: function(record, value, rowNum, colNum, grid) {
return record.attachmentNames;
}
},
{name: "type", title: "<wl:message nlsKey='msgcenter.text.TYPE_MESSAGES' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>",
type: "text", width: "15%"
},
{name: "category", title: "<wl:message nlsKey='msgcenter.text.CATEGORY_MESSAGES' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>",
type: "text", width: "20%"
},
{name: "subject", title: "<wl:message nlsKey='msgcenter.text.SUBJECT_MESSAGES' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>",
type: "text", width: "57%"
},
{name: "receiveddatestring", title: "<wl:message nlsKey='msgcenter.text.RECEIVED_DATE' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>",
type: "date", width: "225", align: "left"
}
]
I am using list grid and set dataPageSize: 20 in the list . All pagination with grid was working fine .
But when I tried to use transformresponse with RestDataSource paging int List grid is lost . Am i doing something wrong with following code , please suggest :
isc.RestDataSource.create({
ID: "msgListdataSource",
dataFormat: "xml",
showPrompt: false,
showPrompt: false,
fetchDataURL : "<%= request.getContextPath() %>/MsgCenterSmartClient/MsgCenterSmartClient_getMessages.action",
updateDataURL:"<%= request.getContextPath() %>/MsgCenterSmartClient/MsgCenterSmartClient_updateReadFlag.action",
removeDataURL:"<%= request.getContextPath() %>/MsgCenterSmartClient/MsgCenterSmartClient_deleteMessage.action",
fields: [
{name: "messageid", type: "text", primaryKey: true},
{name: "priority", type: "text"},
{name: "category", type: "text"},
{name: "type", type: "text"},
{name: "subject", type: "text"},
{name: "receiveddatestring", type: "text"},
{name: "expirydate", type: "text"},
{name: "smstext", type: "text"},
{name: "attachmentnames", type: "text"},
{name: "singleattachmentid", type: "text"},
{name: "readflag", type: "text"},
{name: "icon", type: "image"},
{name: "expiryflag", type: "text"},
{name: "todaysmsg", type: "text"}
],
transformResponse : function (dsResponse, dsRequest, xmlData) {
lastRecievdDate = '' + isc.XMLTools.selectString(xmlData, "/response/lastrecieveddate");
if(lastRecievdDate == 'null') {
lastRecievdDate = '' + isc.XMLTools.selectString(xmlData, "/response/data/record/lastrecieveddate");
}
}
});
isc.ListGrid.create({
ID:"messageList",
width:"100%",
height:"100%",
selectionType: "single",
wrapCells:true,
sortDirection:"ascending",
fixedRecordHeights:true,
showAllRecords: false,
alternateRecordStyles:true,
dataSource: "msgListdataSource",
dataPageSize: 20,
leaveScrollbarGap: false,
loadingMessage: "<wl:message nlsKey='msgcenter.text.Loading' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>",
fields: [
{name: "icon", title: " ", summaryTitle : "<wl:message nlsKey='msgcenter.text.ATTACHMENT_SUMMARY' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>", icon: "<%= request.getContextPath() %>/images/attachment.gif", iconAlign: "center",
width: "45", type: "image", imageURLPrefix: "<%= request.getContextPath() %>/images/",
imageURLSuffix: ".gif", canSort: false, showHover: true, canHover: true,
hoverHTML: function(record, value, rowNum, colNum, grid) {
return record.attachmentNames;
}
},
{name: "type", title: "<wl:message nlsKey='msgcenter.text.TYPE_MESSAGES' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>",
type: "text", width: "15%"
},
{name: "category", title: "<wl:message nlsKey='msgcenter.text.CATEGORY_MESSAGES' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>",
type: "text", width: "20%"
},
{name: "subject", title: "<wl:message nlsKey='msgcenter.text.SUBJECT_MESSAGES' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>",
type: "text", width: "57%"
},
{name: "receiveddatestring", title: "<wl:message nlsKey='msgcenter.text.RECEIVED_DATE' nlsIndent='com.db.portal.liferay.customization.whitelabel.msgcenter'/>",
type: "date", width: "225", align: "left"
}
]
Comment