on 09-27-2007 1:11 PM
Hi All,
I have one requirement where list has to be display based on a column default sort order. For listing, we will give the column names and the default sort order in ListDef.xml file in <defaultsort> tag.
It is working fine for me if I give the Header item field in <defaultsort> tag. If I give the child item field for sorting, list is not displaying based on this field. After I clicking on the hyper link I could see the values.
Can anybody please tell me how to how to get the default sort eventhough I want to display based on child items.
Thanks in Advance,
Murthy
Hi,
I played with standard MAM list that has similar functionality (NotifPartnerList that has an icon for "delete" column) - works perfectly.
Here are two possible reasons that I can think of:
1. In you code shippet you don't show what is returned else then "inspection.gif". Other icon? Empty string? What do you compare "inspection.gif" with for sorting?
2. When you do changes in ListDef.xml do you remove all *.obj files in folder C:\Program Files\SAP Mobile Infrastructure\data\USER_NAME so taht your new list settings are picked and parsed?
Cheera,
Larissa Limarova
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Narsimha,
U have one list with header and child items or having two lists??
I don't think it is possible to sort the Header based on child.
- Chintan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Murthy,
sorting should work fine on any field in the list disregarding where it comes from header/item/other SyncBo.
You can not sort on more than one column though (excerpt "based on child items", can only be one item at a time, not items).
Here is working example code shippets. Sorting field in it comes from other SyncBo but it does not really matter.
zListDef.xml:
<list>
<name>OutstInspNotifList</name>
<maxRowPerPage>15</maxRowPerPage>
<defRowPerPage>10</defRowPerPage>
<maxColPerList>10</maxColPerList>
<managerName>com.sap.mbs.mam.bo.Mam010Manager</managerName>
<managerMethod>getMam010s</managerMethod>
<rowDescriptorMethod>getMam010Descriptor</rowDescriptorMethod>
<ParentBOInterface></ParentBOInterface>
<defaultsort ascending="true">mapSectionComposite</defaultsort>
<linkBuilder>com.ea.mbs.mam.list.link.NotifLinkBuilder</linkBuilder>
<component>notification</component>
<uvmDisplayName>UVM_OUTST_INSP_NOTIF_LIST</uvmDisplayName>
<topline>
<column sortable="true" default="true">
<title>NOTIF_LIST_HD_DISP_MAPSECT</title>
<data type="text">mapSectionComposite</data>
</column>
<column sortable="true" default="true" link="true">
<title>NOTIF_LIST_HD_DISP_POLEID</title>
<data type="text">poleID</data>
</column>
.......
</list>
Sorting field "mapSectionComposite"comes from a characteristic of equipment which is referenced by notification.
Put list in Context for display in custom NotificationList
public Forward onOutstInspNotifListLoad(Forwards forwards) {
BOList dataList = getDataListByType(type);
//dataList is a list of notification for display
setListAttributes(context, notifHeader, dataList, null, null, "onNavigate");
?
public class com.CUSTOMER_EXTENSION.mbs.mam.bo.ext.impl.Mam010Impl extends com.sap.mbs.mam.bo.ext.impl.Mam010Impl {
public Object getField(String key) {
if (key.equals("mapSectionComposite")) {
//PoleId is characteristic "MAPC" in Mam031Item170
if (StringUtility.isEmptyString0((String)super.getField("EQUIPMENT")))
return "";
else {
try {
Mam031 equipment = equipManager.lookupMam031((String)super.getField("EQUIPMENT"));
if (equipment == null) return "";
else {
Condition condition = equipQueryBuilder.getClassificationValueCondition("CHARACT",
RelationalOperatorType.EQUALS, "MAPC");
BOList equipCharacts = (BOList) equipManager.getMam031Item170s(equipment, condition, QueryBuilder.nullSortOrder, QueryBuilder.initialIndex, QueryBuilder.allResultIndex);
if (equipCharacts == null || equipCharacts.size() == 0) return "";
else {
Mam031Item170 equipmentCharacteristic = (Mam031Item170) equipCharacts.get(0);
if (equipmentCharacteristic == null) return "";
else return equipmentCharacteristic.getValueChar();
}
}
} catch (BOException e) {
Log.log(Severities.ERROR, "", e);
return "";
}
}
}
Cheers,
Larissa Limarova
Hi Larissa Limarova,
Thanks for the response. Here I did the same as you said ...
ZlistDef.xml
<list>
<name>NotifList</name>
<managerName>com.sap.mbs.mam.bo.Mam010Manager</managerName>
<managerMethod>getMam010s</managerMethod>
<rowDescriptorMethod>getMam010Descriptor</rowDescriptorMethod>
<ParentBOInterface></ParentBOInterface>
<maxRowPerPage>10</maxRowPerPage>
<defRowPerPage>5</defRowPerPage>
<maxColPerList>6</maxColPerList>
<b> <defaultsort ascending="true">FIELD_VALUE</defaultsort></b>
<linkBuilder>com.sap.mbs.mam.list.link.NotifLinkBuilder</linkBuilder>
<component>notification</component>
<uvmDisplayName>UVM_NOTIFICATION_LIST</uvmDisplayName>
<topline>
<column sortable="true" default="true" link="true">
<title>NOTIF_LIST_HD_DISP_NOTIF</title>
<data type="text">NOTIF_NO</data>
<filterZero>com.sap.mbs.mam.application.filter.impl.NotifNoFilter</filterZero>
</column>
<column sortable="true" default="true">
<title>NOTIF_LIST_HD_DISP_TYPE</title>
<data type="text">NOTIF_TYPE</data>
</column>
<column sortable="true" default="true">
<title>STATUS</title>
<data type="icon">STATUS</data>
</column>
<column sortable="true" default="true" link="true">
<title>ENTRY_LIST</title>
<data type="icon"><b>FIELD_VALUE</b></data>
</column>
</topline>
<otherline default="true">
<title>NOTIF_LIST_HD_SHTEXT</title>
<data type="text">SHORT_TEXT</data>
</otherline>
</list>
Sort Field from Mam010Item030Impl which is a child item of MAM010
public class Mam010Impl extends com.sap.mbs.mam.bo.impl.Mam010Impl implements Mam010 {
public Object getField(String key) {
if (key.equals("FIELD_VALUE"))
{
try
{
BOList notifID = notifManager.getMam010Item030s(this);
mam030 = (Mam010Item030)notifID.get(0);
fieldVal = mam030.getFieldValue();
}
catch(java.lang.ArrayIndexOutOfBoundsException aex)
{
}
catch (BOException e)
{
}
catch(Exception ee)
{
}
if((fieldVal=="")||(fieldVal==null)||(fieldVal.equals(null)))
{
flag = false;
}
else
{
flag=true;
imgPath = "mime/inspection.gif";
}
return imgPath;
}
With this code default sort is not happening.
Can please check my code and let me know where I am doing wrong.
Regards,
Murthy.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.