How can we display a customized message if the data source returns no data in chart and table?
Hii
I want to display a customized message instead of empty chart and table when data source return no data. Currently I am using chart canvas. Is there any element we can used for hide the Chart or table and displaying a message .
Thanks
Seema
-
Hey Seema,
There is an undocumented token that is generated when you set a table to HideWhenZeroRows=True
The token is @Data.rdHideTableRowCount-<table id here>~
Assuming my table id is dt1, I would set dt1 to Hide When Zero Rows = True. Then I add a DIV element containing whatever message (img, label, link, etc.) I want to show when there are no results. The DIV will need the following condition: @Data.rdHideTableRowCount-dt1~=0
Done!
btw... Charts have their own "No Data Caption" attribute with a "No Data Caption Style" element that can be used to customize the look/feel.
Here is a quick sample:
<DataTable AccessibleHeaders="True" AccessibleSummary="DataTable" AjaxPaging="True" HideWhenZeroRows="True" ID="DataTable1" Layout="Fixed" RememberSort="True" SortArrows="True" TableBorder="0" Width="100" WidthScale="%" IdeDisplayStatus="Collapsed">
datalayers...
columns...
etc...
</DataTable>
<Division Condition="@Data.rdHideTableRowCount-DataTable1~=0" HtmlDiv="True" ID="divNoResults" IdeDisplayStatus="Collapsed">
<LineBreak LineCount="3" />
<Label Caption="No results for your selections." Class="ThemeTextNegative" />
</Division>0 -
Hii
I have used the "No Data Caption" in the Chart canvas but its not working ,even though there is no data is available in data source. It shows the empty chart. Is there any restriction for this element?
Can we solve this issue by adding some condition in div element as like datatable.
Thanks
Seema
0 -
HI Seema,
For Chart No Data Caption, you can do 2 things:
- Set the Attribute in the ChartCanvas, set the No Data Caption element to the text you want to show, like "No Data Found" (with quotes removed)
- Use the ChartCanvas child "No Data Caption Style" element to control the styling of your text
If this isn't showing anything, you may want to check the Debugger to confirm that nothing results from your Datalayer.
Thanks,
Johnny0
Please sign in to leave a comment.
Comments
3 comments