Telerik Forums
Kendo UI for jQuery Forum
6 answers
1.9K+ views
Hello,

I have a grid like the one from your demo: http://demos.telerik.com/kendo-ui/grid/hierarchy
<div>
        @{
            Html.Kendo().Grid<TicketModel>()
                .Name("ticketsList")
                .HtmlAttributes(new { @class = "ticketsGrid" })
                .Columns(columns =>
                {
                    columns.Bound(m => m.TicketID).Visible(false);
                    columns.Bound(m => m.TicketNumber);
                    columns.Bound(m => m.TicketTypeName);
                    columns.Bound(m => m.Name);
                    columns.Bound(m => m.Status);
                    columns.Bound(m => m.Severity);
                    columns.Bound(m => m.DaysOpened);
                    columns.Bound(m => m.DateCreated).ClientTemplate("#= kendo.format('{0:d}', kendo.parseDate(DateCreated))#");
                    columns.Bound(m => m.TicketNumber).ClientTemplate("<img title='Add comment' src='" + Url.Content("~/Images/icon_edit.png") + "' onclick=\"location.href='" + Url.Action("AddTicket", "Support", new { ticketId = "#= TicketID #" }) + "'\"/>&nbsp;&nbsp;&nbsp;").Title("").Sortable(false).HtmlAttributes(new { @class = "action-buttons" });
                })
.....
        }
    </div>

    <script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<ActionModel>()
            .Name("ticketsList_#=TicketID#")
            .Columns(columns =>
            {
                columns.Bound(o => o.ActionID);
                columns.Bound(o => o.Description);
                columns.Bound(o => o.Name);
                columns.Bound(o => o.Status);
                columns.Bound(o => o.AttachmentId).ClientTemplate(
                    "# if (o.AttachmentId != null) { #" +
                        "<img title='Download Attachment' src='" + Url.Content("~/Images/Attach.png") + "' onclick=\"location.href='" + Url.Action("AddTicket", "Support", new { ticketId = "#= o.AttachmentId #" }) + "'/>" +
                        "# } #").Title("").Sortable(false).HtmlAttributes(new { @class = "action-buttons" });
            })
......
    )
    </script>
The conditional from the 2nd grid is not working.. if I use the following condition "# if (AttachmentId != null) { #"  i get a javascript error in page that AttachmentId is not defined.

Could you help me please with this one?

Thank you,
Oana





Dimo
Telerik team
 answered on 01 Jun 2016
3 answers
1.5K+ views

I have a custom Edit template working with a grid in that when I show the grid and click the "Edit" button it shows the popup with the data.  I can edit the data and choose the "Update" button and the popup closes.  I can click the "Edit" button again and the popup shows with the modified data.  So far so good.

 

But two things are happening that are not good.  If I click the "Cancel" button I get the following error:

Unhandled exception at line 27, column 1898 in http://localhost:51277/Scripts/kendo/2016.1.18/kendo.all.min.js
0x800a138f - JavaScript runtime error: Unable to get property 'uid' of undefined or null reference

 

Also the data from the Popup is not populating the underlying row visually in the grid.  The popup only has a few of the columns in the grid row but again they remain empty when the popup closes.  When the popup shows again if you again click the "Edit" button the data is in the fields.

 

I have this at the top of the custom editor template which is the unique ID for the row.

@Html.HiddenFor(model => model.strNotificationSubscriptionSeq)

The following code is in place in the Grid markup:

.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("NotificationSubscriptionEditor"))

The Datasource in the grid defines the update method on the controller:

.DataSource(dataSource => dataSource
                      .Ajax()
                      .Model(model => { model.Id(p => p.strNotificationSubscriptionSeq); })
                      .Batch(true)
                      .PageSize(25)
                      .ServerOperation(false)
                      .Events(events => events.Error("error_handler"))
                         .Update("NMSubscriptionUpdate", "NotificationMgr")
                   
                  )

 

One thing to note is that the spec for the main template that contains the grid is to do a batch update for all the rows in grid that are modified.  I have that concept working in other templates which send the JSON to the controller.  All that is working fine but I mention the spec here to state that the controller method does nothing on the backend and just returns the data row item sent into the controller.  When the user clicks the master "Save" button I will post the data to the database.

Here is the controller method:

public ActionResult NMSubscriptionUpdate([DataSourceRequest] DataSourceRequest request,[Bind(Prefix = "models")] GridNotificationSubscriptionDataItem gridNMSubscription)
{
   return Json(gridNMSubscription, JsonRequestBehavior.AllowGet);
}

 

Does someone have a suggestion as to what is going wrong here?  Do I need some JavaScript in the Editor template or the parent main Razor view?

Thanks!

Reid

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Dimiter Topalov
Telerik team
 answered on 01 Jun 2016
1 answer
297 views

My json data for this cells is String i.e. :  "05:20"   {HH:mm} format.

Here is my grid options for this column:

column ...  { title: 'Jazdy', field: 'driving_time', footerTemplate: "#= data.driving_time.sum #"}

aggregate ... { field: "driving_time", aggregate: "sum" }

schema ... model: { fields: { driving_time: { type: "duration" }, ...} ...}

So in this scenario in footer i see value only from last row. How to make it properly to get summary duration in footer?

Georgi Krustev
Telerik team
 answered on 01 Jun 2016
3 answers
964 views
Hello, I have a kendo grid with a column that displays as List<string> using a client template:

columns.Bound(u => u.CostCentreNames)
     .ClientTemplate("#= costCentreList(data) #")
     .Filterable(true)
     .Sortable(false);
function costCentreList(item) {
var html = "";
for (var i = 0; i < item.CostCentreNames.length; i++) {
if (item.CostCentreNames[i] != 'undefined') {
html += "<div>";
html += item.CostCentreNames[i];
html += "</div>";
}
}
return html;
}

CostCentreNames is a List<string>.

Is it possible to filter based on the values of those strings?  i.e. show only rows where that column contains the value '100'. could you provide an example if so.  Thx!
Daniel
Telerik team
 answered on 01 Jun 2016
5 answers
246 views

Hi Guys,

I need to display a chart containing multiple sets of data ranges but the output is rather spaced apart on the big chart area and not very readable.

Is there a way to enable scale breaks on the charts to remove gaps between the ranges and improve readability?

I'm looking for a feature similar to the built in .NET data visualization charting control.

It can be seen in action at following URL and looks quite useful feature.

    https://msdn.microsoft.com/en-us/library/dd207136.aspx

 

Cheers!

Veselin Tsvetanov
Telerik team
 answered on 01 Jun 2016
4 answers
228 views

I've imported a spreadsheet with 12pt text. When displayed on the page, the text size shows 12pt in the toolbar, yet inspecting the size using dev tools in Chrome shows the text is 9px. Since I have a large monitor, this is quite small.

The problem can be seen by importing the spreadsheet attached to this post I had made last week. The problem is visible in the spreadsheet impot/export demo as well.

Now that I'm looking at the demo, I also notice that, while the toolbar shows "12" (and an Excel user would assume that means 12 point), the text there is 12px which, again on my large monitor, is much smaller than 12 pt. 

Thanks.

 

 

T. Tsonev
Telerik team
 answered on 01 Jun 2016
1 answer
2.8K+ views

Hi,

 

I am trying to create a template for grid in kendo-ui. Its formatting is conditional...as follows:

Dataset sample:

json: [{ "name" :"abc", "link":123 },{ "name" :"def", "link":null}...]

The template should be of the logic:

 

link === null ? <span>name</span> : <a target="_blank" href="http://mywebsite/name">#=name#</a>

i.e. conditionally make the text hyperlinked v/s display it as is ("abc" should be displayed with a hyperlink while "def" should not have a hyperlink).
I am able to get the unconditional way of template working with always make the text as hyperlink as follows:
var nameTemplate = '<a target="_blank" href="http://mywebsite/#=name#">#=name#</a>';

But cannot get the template with the above ternary operator logic to work

Thoughts?
Thanks

Dimiter Madjarov
Telerik team
 answered on 01 Jun 2016
2 answers
338 views

Is there a way to use a custom icon (preferably from an icon font like Awseome Fonts) for the notes on a chart ?

 

Below the generic code we use for creating a note, so we would want to change the icon type to be a custom shape/icon/svg instead of one of the four predefined options of "square", "cross", ...

If that is not an option at all, any other way of how this can be achieved ? E.g. I've seen markers on maps can be customized for example.

Attached an example of how the notes currently look in the chart, having such a limited set of icon shapes does not really work for our use case.

var newNote = function (value, type, text, date, background) {
        var note = {
            value: value,
            color: '#606060',
            label: {
                text: text + ': ' + date,
                visible: false
            },
            icon: {
                type: type
            }
        };
        if (background) {
            note.icon.background = background;
        }
        return note;
    };

 

 

Steve
Top achievements
Rank 1
 answered on 31 May 2016
1 answer
177 views

Hi,

i have the following problem. I added virtualization functionality to my Odata-V4 API. Now I added the necessary options to the combobox (using Angular + Typescript) following the instructions from this article: 

http://docs.telerik.com/kendo-ui/controls/editors/combobox/virtualization#itemheight

private initLieferscheinNrCB()
        {
            this.dataSourceService.createDataSource('vwSalesLSAFMitZero').then((res: kendo.data.DataSource) =>
            {

                this.LieferscheinNrCBDS = res;
                this.LieferscheinNrCBDS.options.serverFiltering = true;
                this.LieferscheinNrCBDS.options.serverPaging = true;
                //this.LieferscheinNrCBDS.options.pageSize = 80;
                this.LieferscheinNrCBOptions = {
                    dataSource: this.LieferscheinNrCBDS,
                    dataTextField: 'LSNr_Str',
                    dataValueField: 'LSNr',
                    height: 520,
                   
                    virtual:
                    {
                        itemHeight: 26,
                        valueMapper: (options) =>
                        {
                            this.$log.debug("LSCB Valuemapper");
                            this.odataService.callServer('POST', 'odata/vwSalesLSAFMitZero/Default.RowNumber()', {
                                RowNumber: { Column: "LSNr", Value: options.value }
                            }).then((res: any) =>
                            {
                                this.$log.debug("ValueMapper Res: ", res);
                                options.success(res.value);
                            });
                        }
                    }
                };
            });
        }

<select id="vm.LieferscheinCB"
                                    kendo-combo-box="vm.LieferscheinNrCB"
                                    k-options="vm.LieferscheinNrCBOptions"
                                    k-ng-delay="vm.LieferscheinNrCBOptions"></select>

 

The problem is, that everything works fine when I filter the items. But on the first load, there is no $top nor $skip in the server request, so all items get loaded. This is anoying :-(. Does anybody know this bug or also have a workaround?

 

Best Regards

Benjamin

Simon
Top achievements
Rank 1
 answered on 31 May 2016
1 answer
231 views

I have been looking at migrating from ASP.NET Web forms to MVC and going from UI for ASP.NET Ajax to Kendo. I assumed that the look and feel of the controls would be similar and that the controls I am using would also be available in Kendo. This is not the case.

For example, the Material theme for the Kendo Grid has a totally different look and feel than RadGrid. Moving to Kendo UI would totally change the look of my current application.

There also doesn't seem to many missing controls, such as RadPageLayout. This means that I would have to look for a new non-Telerik layout template and thus, add extra dependencies to my application.

I assumed that there would be similar capabilities and the themes would be comparable between the 2 products but this is obviously not the case. They appear be two totally separate products.

It does mean that I will be looking at other frameworks as the advantages that I thought came with migrating to Kendo from ASP.Net Ajax (compatible controls, same look and feel) don't actually exist.

Rumen
Telerik team
 answered on 31 May 2016
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?