浏览代码

* Proper fix for ExtJS Delete operation which sometimes sends only an ID

git-svn-id: trunk@17912 -
michael 14 年之前
父节点
当前提交
8dfac9c481
共有 1 个文件被更改,包括 9 次插入19 次删除
  1. 9 19
      packages/fcl-web/src/webdata/extjsjson.pp

+ 9 - 19
packages/fcl-web/src/webdata/extjsjson.pp

@@ -15,7 +15,6 @@ type
   private
     FRows : TJSONArray;
     FCurrentRow : TJSONObject;
-    FIDValue : TJSONData;
     FRowIndex : integer;
     function CheckData: Boolean;
   Public
@@ -525,7 +524,10 @@ begin
         FCurrentRow:=TJSONObject(D);
         end
       else if D is TJSONInt64Number then
-        FIDValue:=D
+        begin
+        FRows:=nil;
+        FCurrentRow:=TJSONObject.Create(['ID',D]);
+        end
       else
         begin
         FreeAndNil(D);
@@ -545,7 +547,6 @@ begin
   else
     FreeAndNil(FRows);
   FRowIndex:=0;
-  FreeAndNil(FIDValue);
   inherited reset;
 end;
 
@@ -571,22 +572,13 @@ Var
   I : Integer;
 
 begin
-  Avalue:='';
   Result:=False;
   if CheckData then
     begin
-    If Assigned(FIDValue) and (0=CompareText(AFieldName,'ID')) then
-      begin
-      AValue:=FIDValue.AsString;
-      Result:=True;
-      end
-    else
-      begin
-      I:=FCurrentRow.IndexOfName(AFieldName);
-      Result:=I<>-1;
-      if result then
-        AValue:=FCurrentRow.Items[I].AsString;
-      end;
+    I:=FCurrentRow.IndexOfName(AFieldName);
+    Result:=I<>-1;
+    if result and (FCurrentRow.Items[I].JSONType<>jtNull) then
+      AValue:=FCurrentRow.Items[I].AsString;
     end;
 end;
 
@@ -595,9 +587,7 @@ begin
   If Assigned(FRows) then
     FreeAndNil(FRows)
   else if assigned(FCurrentRow) then
-    FreeAndNil(FCurrentRow)
-  else if Assigned(FIDValue) then
-    FreeAndNil(FIDValue);
+    FreeAndNil(FCurrentRow);
   inherited destroy;
 end;