
| Key: |
GDS-523
|
| Type: |
New Feature
|
| Status: |
Resolved
|
| Resolution: |
Fixed
|
| Priority: |
Minor
|
| Assignee: |
William Draï
|
| Reporter: |
heyoulin
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
need to supprt map PagedCollection using id instead of uddi
change: org.granite.tide.collections.PagedCollection.as
public override function getItemIndex(obj:Object):int {
if (obj == null)
return -1;
// log.debug("getItemIndex {0}", obj);
if (localIndex) {
// Local data available: lookup by id
if(obj is IUID)
{
for (var idx:int = 0; idx < localIndex.length; idx++) {
if (IUID(obj).uid == IUID(localIndex[idx]).uid)
return _first + idx;
}
}
else
{
for (idx = 0; idx < localIndex.length; idx++) {
if(obj.ID)
if (obj.ID == localIndex[idx].ID)
return _first + idx;
if(obj.id)
if (obj.id == localIndex[idx].id)
return _first + idx;
}
}
}
return -1;
}
private function nullCompare(o1:Object, o2:Object, fields:Array = null):int {
if (o1 is IUID && o2 is IUID) {
if (IUID(o1) == IUID(o2))
return 0;
return 1;
}
else
{
if (o1!=null && o2 !=null) {
if(o1.ID)
if (o1.ID == o2.ID)
return 0;
if(o1.id)
if (o1.id == o2.id)
return 0;
return 1;
}
}
return 0;
}
server side can use List<Map> as resultList. map must contain id key
|
|
Description
|
need to supprt map PagedCollection using id instead of uddi
change: org.granite.tide.collections.PagedCollection.as
public override function getItemIndex(obj:Object):int {
if (obj == null)
return -1;
// log.debug("getItemIndex {0}", obj);
if (localIndex) {
// Local data available: lookup by id
if(obj is IUID)
{
for (var idx:int = 0; idx < localIndex.length; idx++) {
if (IUID(obj).uid == IUID(localIndex[idx]).uid)
return _first + idx;
}
}
else
{
for (idx = 0; idx < localIndex.length; idx++) {
if(obj.ID)
if (obj.ID == localIndex[idx].ID)
return _first + idx;
if(obj.id)
if (obj.id == localIndex[idx].id)
return _first + idx;
}
}
}
return -1;
}
private function nullCompare(o1:Object, o2:Object, fields:Array = null):int {
if (o1 is IUID && o2 is IUID) {
if (IUID(o1) == IUID(o2))
return 0;
return 1;
}
else
{
if (o1!=null && o2 !=null) {
if(o1.ID)
if (o1.ID == o2.ID)
return 0;
if(o1.id)
if (o1.id == o2.id)
return 0;
return 1;
}
}
return 0;
}
server side can use List<Map> as resultList. map must contain id key |
Show » |
Sort Order:
|
can change to this ??
public override function getItemIndex(obj:Object):int {
if (obj == null)
return -1;
// log.debug("getItemIndex {0}", obj);
if (localIndex) {
var idx:int;
if (obj is IUID) {
// Local data available: lookup by id
for (idx = 0; idx < localIndex.length; idx++) {
if (IUID(obj).uid == IUID(localIndex[idx]).uid)
return _first + idx;
}
}
else if (obj.hasOwnProperty("uid")) {
//
GDS-523for (idx = 0; idx < localIndex.length; idx++) {
if (obj.uid == localIndex[idx].uid)
return _first + idx;
}
}
else if (obj.hasOwnProperty("UID")) {
//
GDS-523for (idx = 0; idx < localIndex.length; idx++) {
if (obj.UID == localIndex[idx].UID)
return _first + idx;
}
}
}
return -1;
}
private function nullCompare(o1:Object, o2:Object, fields:Array = null):int {
if (o1 is IUID && o2 is IUID) {
if (IUID(o1) == IUID(o2))
return 0;
return 1;
}
//
GDS-523if (o1 != null && o2 != null && o1.hasOwnProperty("uid") && o2.hasOwnProperty("uid")) {
if (o1.uid == o2.uid)
return 0;
return 1;
}
//
GDS-523if (o1 != null && o2 != null && o1.hasOwnProperty("UID") && o2.hasOwnProperty("UID")) {
if (o1.UID == o2.UID)
return 0;
return 1;
}
return 0;
}