Mar 31, 2013, 8:15 PM
[CLOSED] Dynamic columns for data view
Hi All,
I am trying to create a page based on the example below but with dynamic columns.
https://examples2.ext.net/#/DataView/Advanced/Report/
I don't know amount of columns it will come from the server. As far I can understand it could be done like this:
Thanks,
Alexander
I am trying to create a page based on the example below but with dynamic columns.
https://examples2.ext.net/#/DataView/Advanced/Report/
I don't know amount of columns it will come from the server. As far I can understand it could be done like this:
<ext:DataView runat="server" DisableSelection="true" ItemSelector="td.letter-row" EmptyText="No data to display">
<Store>
<ext:Store ID="dsReport" runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="header" IsComplex="true" />
<ext:ModelField Name="data" IsComplex="true" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Tpl ID="Template1" runat="server">
<Html>
<p>Customer Address Book</p>
<table>
<tpl for=".">
<tr>
<tpl for="header">
<th>{headerName}</th>
</tpl>
</tr>
</tpl>
<tpl for=".">
<tr>
<td class="letter-row" colspan="6">
<div><h2 class="letter-selector">{Letter}</h2></div>
<tpl for="data">
<table>
<tr class="customer-record">
<td class="cust-name" custID="{CustomerID}" custName="{CompanyName}" email="{Email}" style="width:10%">{ContactName}</td>
<td style="width:18%"> {Address}</td>
<td style="width:18%"> {City}</td>
<td style="width:18%"> {Region}</td>
<td style="width:18%"> {PostalCode}</td>
<td style="width:18%"> {Country}</td>
</tr>
</table>
</tpl>
</td>
</tr>
</tpl>
</table>
</Html>
</Tpl>
</ext:DataView>
However, I do not want to use complex fields to define a data, because in this case I will lose standard store sorting abilities. I would prefer to define header and data in different stores or at least, header can be defined separately in array, I just need only to know how to tell xtemplate to use separate data sources for header and data.Thanks,
Alexander
Last edited by Daniil; Apr 04, 2013 at 4:25 AM.
Reason: [CLOSED]