Subject | Trees and IBO |
---|---|
Author | Cristian Ivan |
Post date | 2001-06-16T06:15:40Z |
Hi !
I wonder what's the best sollution for the following problem.
There is a tree with categories and subcateories and some grids with
data. I need the data in the grids to function like "master-details"
with the tree. The problem is that the only sollution I've found was
to set the filter of the grid's dataset to some data I've memorized in
each node's object (and also the default values, in this case).
Something like:
procedure TFormMain.CategTreeSelectionChanged(Sender: TObject; Node: TDCTreeNode);
var st,st2:string;
begin
if not (node=nil) then begin
if node.parent=nil then begin
st:='categorie='+IntToStr(node.overlayindex);
st2:='';
end
else begin
st:='categorie='+IntToStr(node.parent.overlayindex);
st2:='subcateg='+IntToStr(node.overlayindex);
end;
q.DefaultValues.Clear;
q.DefaultValues.append('stoc=0');
q.DefaultValues.append(st);
q.DefaultValues.append(st2);
q.Filter:=st;
if st2<>'' then q.filter:=q.filter+' and '+st2;
q.Filtered:=true;
end
end;
Using filters like this works just fine, but I wonder if there is
a better approach to simulate a master detail relationship between a
non-dataware component and a dataset.
thanks,
Cristian IVAN
--
Best regards,
cRIS mailto:cris@...
I wonder what's the best sollution for the following problem.
There is a tree with categories and subcateories and some grids with
data. I need the data in the grids to function like "master-details"
with the tree. The problem is that the only sollution I've found was
to set the filter of the grid's dataset to some data I've memorized in
each node's object (and also the default values, in this case).
Something like:
procedure TFormMain.CategTreeSelectionChanged(Sender: TObject; Node: TDCTreeNode);
var st,st2:string;
begin
if not (node=nil) then begin
if node.parent=nil then begin
st:='categorie='+IntToStr(node.overlayindex);
st2:='';
end
else begin
st:='categorie='+IntToStr(node.parent.overlayindex);
st2:='subcateg='+IntToStr(node.overlayindex);
end;
q.DefaultValues.Clear;
q.DefaultValues.append('stoc=0');
q.DefaultValues.append(st);
q.DefaultValues.append(st2);
q.Filter:=st;
if st2<>'' then q.filter:=q.filter+' and '+st2;
q.Filtered:=true;
end
end;
Using filters like this works just fine, but I wonder if there is
a better approach to simulate a master detail relationship between a
non-dataware component and a dataset.
thanks,
Cristian IVAN
--
Best regards,
cRIS mailto:cris@...