This is a migrated thread and some comments may be shown as answers.

[Solved] Appending text to a field in each row

1 Answer 825 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wim
Top achievements
Rank 1
Wim asked on 08 Dec 2014, 02:41 PM
I have a grid that lists the quantity of every product. However, I'd like the unit type appended to the quantity field. Is it possible to define this in the ASP.NET MVC fluent grid builder, or will I have to write a jQuery script that appends the appropriate unit type for each row? Ideally, the solution would be something along the lines of:
1.columns.Bound(o => o.Quantity).Title("Quantity").Append(o => o.UnitType);

My grid:
01.@(Html.Kendo().Grid<ViewModels.SupplyViewModel>()
02.    .Name("GridSupply")
03.    .Columns(columns => {
04.        columns.Bound(o => o.ProductNo).Title("Product").Width(135);
05.        columns.Bound(o => o.Quantity).Title("Quantity");
06.    })
07.    .DataSource(d => d
08.        .WebApi()
09.        .Model(m => m.Id(o => o.OVR_URID))
10.        .Read(c => c.Url(Url.HttpRouteUrl("DefaultApi", new { controller = "Supply" })))
11.    )
12.)

The desired output would be (the text in bold is appended):
01.<tr>
02.    <td>Product ABC</td>
03.    <td>1000 BOTTLES</td>
04.</tr>
05.<tr>
06.    <td>Product DEF</td>
07.    <td>1000 BOXES</td>
08.</tr>
09.<tr>
10.    <td>Product GHI</td>
11.    <td>1000 SACKS</td>
12.</tr>

1 Answer, 1 is accepted

Sort by
0
Accepted
Kiril Nikolov
Telerik team
answered on 10 Dec 2014, 10:00 AM
Hello Wim,

This functionality cannot be achieved built-in, but you can write, some custom JavaScript code in order to append the values that you need. I have created an example that you can use as a base reference here:

http://dojo.telerik.com/aKOni

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Wim
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or