Skip to content

Commit 13dd718

Browse files
committed
chore(common): fix snippets
1 parent c100af8 commit 13dd718

File tree

7 files changed

+48
-42
lines changed

7 files changed

+48
-42
lines changed
-29.2 KB
Binary file not shown.

components/grid/templates/row.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Render the entire row with your own code and logic
2828
<TelerikGrid Data=@MyData Height="500px">
2929
<RowTemplate Context="employee">
3030
<td>
31-
<img class="rounded-circle" src="@($"/images/{employee.ID}.jpg")" alt="employee photo" />
31+
<TelerikAvatar Type="AvatarType.Text">E @employee.ID</TelerikAvatar>
3232
<strong>@employee.Name</strong>
3333
</td>
3434
<td>
@@ -50,18 +50,14 @@ Render the entire row with your own code and logic
5050
}
5151
5252
public IEnumerable<SampleData> MyData = Enumerable.Range(1, 50).Select(x => new SampleData
53-
{
54-
ID = x,
55-
Name = "name " + x,
56-
HireDate = DateTime.Now.AddDays(-x)
57-
});
53+
{
54+
ID = x,
55+
Name = "name " + x,
56+
HireDate = DateTime.Now.AddDays(-x)
57+
});
5858
}
5959
````
6060

61-
>caption The result from the code snippet above
62-
63-
![Blazor Grid Row Template](images/row-template.png)
64-
6561

6662
## See Also
6763

components/spreadsheet/tools.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ The example below shows how to:
9898
@using Telerik.Blazor.Resources
9999
@using Telerik.Blazor.Services
100100
101-
@inject ITelerikStringLocalizer Localizer
101+
@* Needed to find the built-in Home tool by its localized title if the application is using more than one language *@
102+
@* @inject ITelerikStringLocalizer Localizer *@
102103
103104
<TelerikSpreadsheet Tools="@DefaultToolsWithCustomizations">
104105
</TelerikSpreadsheet>
@@ -117,10 +118,13 @@ The example below shows how to:
117118
fileToolSetItem.Title = "Custom File Label";
118119
}
119120
120-
// Find the built-in Home tool set item by its localized title.
121-
// You can hard-code the title string (for example, "Home") if the application is using just one language.
121+
// Find the built-in Home tool set item.
122+
// This example uses hard-coded title string ("Home") but you may use the tool's localized title if the application is using more than one language.
123+
// SpreadsheetToolSetItem? homeToolSetItem = DefaultToolsWithCustomizations.Items
124+
// .FirstOrDefault(x => x.Title == Localizer[nameof(Messages.Spreadsheet_ToolBar_HomeMenu)]);
125+
122126
SpreadsheetToolSetItem? homeToolSetItem = DefaultToolsWithCustomizations.Items
123-
.FirstOrDefault(x => x.Title == Localizer[nameof(Messages.Spreadsheet_ToolBar_HomeMenu)]);
127+
.FirstOrDefault(x => x.Title == "Home");
124128
125129
var fontFamilyTool = homeToolSetItem?.Tools.FirstOrDefault(x => x is SpreadsheetFontFamilyTool) as SpreadsheetFontFamilyTool;
126130

components/stockchart/labels-template-and-format.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,18 @@ You can use the `Format` parameter to apply standard [numeric format strings](ht
2424

2525
>caption Format the labels on the Value and Category Axes
2626
27-
<!-- REPL skipped due to https://github.com/telerik/blazor-repl/issues/323 -->
28-
<div class="skip-repl"></div>
2927
````RAZOR
3028
Standard number format strings and rotate the labels of the Category Axis
3129
3230
<TelerikStockChart Width="700px"
33-
Height="450px"
34-
DateField="@nameof(StockDataPoint.Date)">
31+
Height="450px"
32+
DateField="@nameof(StockDataPoint.Date)">
3533
3634
<StockChartCategoryAxes>
3735
<StockChartCategoryAxis BaseUnit="@ChartCategoryAxisBaseUnit.Months">
38-
<StockChartCategoryAxisLabels Format="{0:D}"></StockChartCategoryAxisLabels>
39-
<StockChartCategoryAxisLabelsRotation Angle="30"></StockChartCategoryAxisLabelsRotation>
36+
<StockChartCategoryAxisLabels Format="{0:D}">
37+
<StockChartCategoryAxisLabelsRotation Angle="30"></StockChartCategoryAxisLabelsRotation>
38+
</StockChartCategoryAxisLabels>
4039
</StockChartCategoryAxis>
4140
</StockChartCategoryAxes>
4241
@@ -48,23 +47,28 @@ Standard number format strings and rotate the labels of the Category Axis
4847
4948
<StockChartSeriesItems>
5049
<StockChartSeries Type="StockChartSeriesType.Candlestick"
51-
Name="Product 1"
52-
Data="@StockChartProduct1Data"
53-
OpenField="@nameof(StockDataPoint.Open)"
54-
CloseField="@nameof(StockDataPoint.Close)"
55-
HighField="@nameof(StockDataPoint.High)"
56-
LowField="@nameof(StockDataPoint.Low)">
50+
Name="Product 1"
51+
Data="@StockChartProduct1Data"
52+
OpenField="@nameof(StockDataPoint.Open)"
53+
CloseField="@nameof(StockDataPoint.Close)"
54+
HighField="@nameof(StockDataPoint.High)"
55+
LowField="@nameof(StockDataPoint.Low)">
5756
</StockChartSeries>
5857
</StockChartSeriesItems>
5958
6059
<StockChartNavigator>
61-
<StockChartNavigatorCategoryAxisLabels Format="" Template=""></StockChartNavigatorCategoryAxisLabels>
60+
<StockChartNavigatorCategoryAxis>
61+
<StockChartNavigatorCategoryAxisLabels>
62+
<StockChartNavigatorCategoryAxisLabels Format="dd MMM yyyy"></StockChartNavigatorCategoryAxisLabels>
63+
</StockChartNavigatorCategoryAxisLabels>
64+
</StockChartNavigatorCategoryAxis>
65+
6266
<StockChartNavigatorSeriesItems>
6367
<StockChartNavigatorSeries Type="StockChartSeriesType.Line"
64-
Name="Product 1"
65-
Data="@StockChartProduct1Data"
66-
Field="@(nameof(StockDataPoint.High))"
67-
CategoryField="@(nameof(StockDataPoint.Date))">
68+
Name="Product 1"
69+
Data="@StockChartProduct1Data"
70+
Field="@(nameof(StockDataPoint.High))"
71+
CategoryField="@(nameof(StockDataPoint.Date))">
6872
</StockChartNavigatorSeries>
6973
</StockChartNavigatorSeriesItems>
7074
</StockChartNavigator>
@@ -146,8 +150,6 @@ In a *value axis* label template, you can use the following fields:
146150
147151
>caption Custom templates in labels
148152
149-
<!-- REPL skipped due to https://github.com/telerik/blazor-repl/issues/323 -->
150-
<div class="skip-repl"></div>
151153
````RAZOR
152154
Label templates
153155
@@ -179,7 +181,9 @@ Label templates
179181
</StockChartSeriesItems>
180182
181183
<StockChartNavigator>
182-
<StockChartNavigatorCategoryAxisLabels Format="" Template=""></StockChartNavigatorCategoryAxisLabels>
184+
<StockChartNavigatorCategoryAxis>
185+
<StockChartNavigatorCategoryAxisLabels Template="#= value.toLocaleDateString('en-US') #"></StockChartNavigatorCategoryAxisLabels>
186+
</StockChartNavigatorCategoryAxis>
183187
<StockChartNavigatorSeriesItems>
184188
<StockChartNavigatorSeries Type="StockChartSeriesType.Line"
185189
Name="Product 1"

knowledge-base/grid-aggregates-and-datatable.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ I have a TelerikGrid with a [DataTable binding](https://demos.telerik.com/blazor
4343

4444
Attempting to use built-in aggregates with the templates that need to extract their values will throw an exception for the aggregated field, for example `Salary` in this snippet (it is the first one declared).
4545

46+
<div class="skip-repl"></div>
4647
````RAZOR
4748
@using System.Data
4849
@using Telerik.DataSource.Extensions

knowledge-base/grid-conditional-cell-background.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ You can fully control the row rendering through a [row template]({%slug grid-tem
135135
// to style the entire row, you can use the same class for all cells, or their style attribute
136136
// to style individual cells - either use their style attribute, or apply a conditional class only to them
137137
138-
<td style="@GetConditionalCellStyle(currRowData)" class="@GetConditionalCellClass(currRowData)">
139-
<img class="rounded-circle" src="@($"/images/{currRowData.ID}.jpg")" alt="employee photo" />
138+
<td style="@GetConditionalCellStyle(currRowData)" class="@GetConditionalCellClass(currRowData)">
140139
<strong>@currRowData.Name</strong>
141140
</td>
142141
<td class="@GetConditionalCellClass(currRowData)">
@@ -162,7 +161,7 @@ You can fully control the row rendering through a [row template]({%slug grid-tem
162161
163162
string GetConditionalCellClass(SampleData rowData)
164163
{
165-
if(rowData.ID % 3 == 0)
164+
if (rowData.ID % 3 == 0)
166165
{
167166
return "yellow-cell-bg";
168167
}
@@ -177,11 +176,11 @@ You can fully control the row rendering through a [row template]({%slug grid-tem
177176
}
178177
179178
public IEnumerable<SampleData> MyData = Enumerable.Range(1, 50).Select(x => new SampleData
180-
{
181-
ID = x,
182-
Name = "name " + x,
183-
HireDate = DateTime.Now.AddDays(-x)
184-
});
179+
{
180+
ID = x,
181+
Name = "name " + x,
182+
HireDate = DateTime.Now.AddDays(-x)
183+
});
185184
}
186185
````
187186

knowledge-base/grid-expand-button-tooltip.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ The example below shows one way to do that, and to distinguish a particular grid
8989
{
9090
// using try-catch to prevent JSInterop calls at too early stage
9191
// ensure the hierarchy expand icons have the desired tooltip after the grid re-renderes with new data
92+
// ensure the HTML is rendered in the browser
93+
await Task.Delay(100);
9294
await _js.InvokeVoidAsync("setGridExpandButtonTitles", ".titles-on-expand-buttons", "Expand Details");
9395
}
9496
catch (InvalidOperationException e) { }

0 commit comments

Comments
 (0)