Show example
|
- You can search in TreeGrid cells strings like Google or by expression like TreeGrid formula.
Click to Help button to see the syntax.
- The found rows or cells can be filtered, selected, colored or focused.
- Search interface can be provided by space row
<Search>.
You can have more <Search> rows to provide more functions and settings for search.
- The search setting is in <Cfg> tag, attributes
SearchExpression,
SearchAction,
SearchType,
SearchMethod,
SearchDefs,
SearchCols.
You can set these attributes also by you custom user interface or script to better control searching see also
Special rows tutorial.
- If you use server paging, you have to provide your own searching on server according to sent attributes listed above, similarly to sorting.
- You can suppress search according to some column by
CanSearch
attribute.
- To control searching from client script you can use
OnSearch and
OnSearchFinish state events,
OnRowSearch control event and
DoSearch API method.
|
Show data source
<Grid>
<Cfg id="Features4" ConstHeight="1"
SaveAttrs="S3,List,S5,List,S6,T1,S6,T2,S6,E1,S6,E2"/>
<Cols>
<C Name="id" Type="Text"/>
<C Name="A" Type="Text"/>
<C Name="B" Type="Text"/>
<C Name="C" Type="Float"/>
<C Name="D" Type="Enum"
Enum="|Zero|One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten"/>
<C Name="E" Type="Date"/>
</Cols>
<Header id="id" A="Text1" B="Text2"
C="Float" D="Enum" E="Date"/>
<Body>
<B>
<I id="r01" A="James Smith" B="Paris" C="10.3" D="1" E="1/1/2000"/>
<I id="r02" A="Mark Jones" B="London" C="12" D="2" E="6/25/2007"/>
<I id="r03" A="Eric Walker" B="Berlin" C="-10.3" D="1" E="1/1/2000"/>
<I id="r04" A="James King" B="London" C="1200" D="6" E="12/31/1999"/>
<I id="r05" A="Henry Smith" B="Rome" C="0.03" D="8" E="6/24/2007"/>
<I id="r06" A="Carl Hill" B="Paris" C="12.45" D="0" E="4/8/2004"/>
<I id="r07" A="Mark Brown" B="Lisboa" C="0.345" D="10" E="10/20/2001"/>
<I id="r08" A="Joe Walker" B="Berlin" C="-12" D="3" E="10/20/2001"/>
<I id="r09" A="Eric Jones" B="Prague" C="-0.345" D="4" E="4/16/1994"/>
<I id="r10" A="James Smith" B="Wroclaw" C="4560" D="10" E="6/25/2007"/>
<I id="r11" A="Jack Reed" B="Madrid" C="1200" D="2" E="4/13/2010"/>
<I id="r12" A="Mark Brown" B="Budapest" C="10.3" D="7" E="5/6/2002"/>
<I id="r13" A="Jack Rogers" B="Moscow" C="12" D="1" E="2/18/1999"/>
<I id="r14" A="James Davis" B="Prague" C="-0.345" D="9" E="4/12/2006"/>
<I id="r15" A="Fred James" B="Moscow" C="12.46" D="9" E="3/25/2005"/>
<I id="r16" A="Billy Smith" B="Rome" C="-1200" D="2" E="1/24/2000"/>
</B>
</Body>
<Solid>
<I Space="4" Html="<DIV style='font-size:11px;padding-left:5px;color:blue;'>Simple searching, filter rows after input expression<DIV>"/>
<Search id="S1" Space="4"
Cells="Expression"
ExpressionAction="Filter"
/>
<I Space="4" Html="<DIV style='font-size:11px;padding-left:5px;color:blue;'>Simple searching with buttons for actions<DIV>"/>
<Search id="S2" Space="4"
Cells="Expression,Filter,Select,Mark,Find,Clear,Help"
/>
<I Space="4" Html="<DIV style='font-size:11px;padding-left:5px;color:blue;'>Simple searching with button and combo for actions<DIV>"/>
<Search id="S3" Space="4"
Cells="Expression,Actions,Search,Clear"
/>
<I Space="4" Html="<DIV style='font-size:11px;padding-left:5px;color:blue;'>Set specific attributes for searching<DIV>"/>
<Search id="S4" Space="4"
Cells="Cols,Case,Type"
ColsLabel="Columns"
ColsDefaults="|All|Text1|Text2|Text1 & Text2|Float|Enum|Date"
ColsCols="||A|B|A,B|C|D|E"
ColsToolTip="Searches only in selected columns"
CaseLabel="Case&nbsp;sensitive"
TypeLabel="Search&nbsp;in&nbsp;cells"
NoColor="1"
/>
<I Space="4" Html="<DIV style='font-size:11px;padding-left:5px;color:blue;'>Predefined filters<DIV>"/>
<Search id="S5" Space="4"
Cells="List,Actions"
ListWidth="150"
ListDefaults="|None|This year|Last year|April|Positive float|Rome|London or Paris|James from London|Eight or less then four"
ListExpressions="@@Date>=1/1/2007 AND Date<1/1/2008@Date>=1/1/2006 AND Date<1/1/2007@(new window.Date(Date)).getMonth()==3@Float>=0@Text2 = Rome@Text2==London or Text2==Paris@Text2==London and Text1 starts James@Enum==8 || Enum<4"
ActionsAction="Refresh"
/>
<I Space="4" Html="<DIV style='font-size:11px;padding-left:5px;color:blue;'>Selects rows according to more filters<DIV>"/>
<I Space="4" Html="<DIV style='font-size:11px;padding-left:5px;font-style:italic;'>Cannot be done by Search row; must be done by standard Space row<DIV>"/>
<I id="S6" Space="4"
Cells="T1,L1,T2,L2,E1,L3,E2,Select"
T1Type="Select" T1="Any" T1Width="65"
T1Defaults="|Any|*RowsAllColB*"
T2Type="Select" T2="Any" T2Width="65"
T2Defaults="|Any|*RowsAllColB*"
E1Type="Select" E1="Any" E1Width="55"
E1Defaults="|Any|Zero|One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten"
E2Type="Select" E2="Any" E2Width="55"
E2Defaults="|Any|Zero|One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten"
L1="or" L1Width="17"
L1CanFocus="0" L1NoColor="1"
L2="and" L2CanFocus="0"
L2Width="24" L2NoColor="1"
L3="or" L3CanFocus="0"
L3Width="17" L3NoColor="1"
SelectType="Button"
SelectCaption="Select"
SelectAction="
var t='',e='';
if(T1!='Any') t+='Text2='+T1;
if(T2!='Any') t+=(t?' or ':'')+'Text2='+T2;
if(E1!='Any') e+='Enum='+choose(E1,split(Row['E1Defaults']),[null,0,1,2,3,4,5,6,7,8,9,10]);
if(E2!='Any') e+=(e?' or ':'')+'Enum='+choose(E2,split(Row['E2Defaults']),[null,0,1,2,3,4,5,6,7,8,9,10]);
if(t&&e) t='('+t+')and('+e+')';
else if(e) t=e;
Grid.SearchExpression=t;
Grid.DoSearch('Select');
"
NoColorState="1"
/>
</Solid>
</Grid>
|