Telerik Forums
Kendo UI for jQuery Forum
3 answers
627 views

I have a grid with the toolbar to export grid data in excel. Exporting grid data to excel works however i need to modify value of one of the column when it gets exported. The grid has inline editing, when in edit mode the 'Gender' column changes to dropdownlist. The value of 'GenderCombinedValues' is the combination of 4 properties with comma delimiter. When exporting grid data to excel, the Gender column exports data value (4 properties with comma delimeter) and i want to only export text value of the Gender column.

 Model:

 

public class SupplierSelfServiceResultViewModel
{
    public List<ContactPersonDetailsViewModel> contactPersonDetails   { get; set; }
}
 
public class ContactPersonDetailsViewModel
{
    public string LineID                         { get; set; }
    public string FirstName                      { get; set; }
    public string LastName                       { get; set; }
                                                  
    [Display(Name = "Gender")]                  
    public string Gender                         { get; set; }
    public string GenderProductCode              { get; set; }
    public string GenderUserDefinedCodes         { get; set; }
    public string GenderUserDefinedCode          { get; set; }
    [Display(Name = "Gender")]                  
    public string GenderCombinedValues           { get; set; } 
   //combination of Gender, GenderProductCode, GenderUserDefinedCodes, GenderUserDefinedCode
}
 
public class CommonDetailsViewModel
{
    public List<GenderItem> Genders              { get; set; }       
}
 
public class GenderItem : CommonDetailsCommonProperties
{
    public string Gender               { get; set; }
    public string ProductCode          { get; set; }
    public string UserDefinedCodes     { get; set; }
    public string UserDefinedCode      { get; set; }
    public string CombinedValuesToSave { get; set; }
   //combination of Gender, ProductCode, UserDefinedCodes, UserDefinedCode
}

EditorTemplate:

 

@using System.Collections
@using Kendo.Mvc.UI;
 
@(Html.Kendo().DropDownList()
 .BindTo((IEnumerable)ViewBag.GenderList)
    .OptionLabel("- Select Gender - ")
    .DataValueField("CombinedValuesToSave")
    .DataTextField("Gender")
    .Name("GenderCombinedValues")
)

View:

@(Html.Kendo().Grid(Model.contactPersonDetails)
    .Name("GridContactPersonDetails")
    .Columns(columns =>
    {
        columns.Command(command => { command.Edit(); }).Width("180px").Title("Action");
        columns.Bound(e => e.LineID).Width("200px").Visible(Model.ContactPersonColumns.LineID);
        columns.Bound(e => e.FirstName).Width("120px");
        columns.Bound(e => e.LastName).Width("120px");
        columns.Bound(e => e.GenderCombinedValues).Width("120px").EditorTemplateName("_GenderDropDownList").ClientTemplate("#:Gender#");
    })
    .Excel(excel => excel
        .FileName("ContactPersonDetails.xlsx")
        .ProxyURL(Url.Action("Excel_Export_Save", "Supplier"))
        .AllPages(true))
    .ToolBar(tools =>
    {
        tools.Template(@<text>                                                                                                                 <div class="col-lg-1 col-md-2 col-sm-2 col-xs-4 pull-right" style="padding-left: 0; margin-top: 2px; text-align: right;">
      <a class="k-button k-button-icontext k-grid-excel POexport" href="#" style="padding-left: 10px;" title="Export to Excel"><span class="k-icon k-i-excel"></span></a>
                           </div>                                  
                        </text>);
    })
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(10)
                .ServerOperation(false)
                .Events(events => events.Error("webMethodErrHandler"))
                .Model(model =>
                {
                    model.Id(p => p.LineID);
                    model.Field(p => p.LineID).Editable(false);
                })
                .Create(update => update.Action("CreateContactPersonDetail", "SupplierSelfService"))
                .Update(update => update.Action("UpdateContactPersonDetail", "SupplierSelfService")))           
)
 

 Controller

 

public ActionResult Index()
{
    SupplierSelfServiceResultViewModel model = service.InvokeGetContactInfo();
     
    CommonDetailsViewModel commonDetailsViewModel = commonService.InvokeGetContacts();
    ViewBag.GenderList = commonDetailsViewModel.Genders;
     
    return View(model);
}

[HttpPost]
public ActionResult Excel_Export_Save(string contentType, string base64, string fileName)
{
    var fileContents = Convert.FromBase64String(base64);
    return File(fileContents, contentType, fileName);
}
 

 Any suggestion how can i achieve that? See attached excel.png to get the idea of the exported data.

Thanks

Avinash

Avinash
Top achievements
Rank 1
 answered on 28 Jan 2016
2 answers
471 views

After upgrading to 2016.1.118 then kendo.all.js is not minimized by my asp.net mvc 5 application.

 My bundle:

bundles.Add(new ScriptBundle("~/bundles/kendoall") .Include("~/Scripts/kendo/kendo.all.js"));

 

The top of the returned js:

 /* Minification failed. Returning unminified contents. (99404,17-26): run-time error JS1019: Can't have 'break' outside of loop: break OUT */ /** * Kendo UI v2016.1.118 (http://www.telerik.com/kendo-ui) * Copyright 2016 Telerik AD. All rights reserved. *

Alex Gyoshev
Telerik team
 answered on 28 Jan 2016
1 answer
324 views

I am using a grid in my layout, that supports refresh and autorefresh option. After performing a refresh, focused cell loses focus. Is there a way to keep the focus using current method of grid? After performing a refresh, table is rendered with new generated uid, that's the issue probably.

 

 

Alexander Valchev
Telerik team
 answered on 28 Jan 2016
2 answers
126 views

I have an angular app that uses a listview to display a set of charts on multiple views.  All of the chart information is kept in a parent controller.  I am currently using line, bar, and stacked area charts.  On the initial load of the charts everything draws correctly. When I reorder the charts using drag and drop or when I try to draw the charts on another view, the stacked area charts do not redraw.  The canvas is there with the correct title, value axis, and category axis information but no actual graph.  If I look at the chart object in the Chrome Developer Tools, I can see the datasource set with valid data.  Any ideas about what could be causing this to happen?  I have attached images showing the initial load and the result after the drag and drop.

Iliana Dyankova
Telerik team
 answered on 28 Jan 2016
5 answers
524 views

Hi

I am trying Grid paging feature with WebAPI and Below is my code sample-

HTML page-

<div id="example">
        <div id="grid"></div>
        <script>
            $(document).ready(function () {
                $("#grid").kendoGrid({
                    dataSource: {
                        //type: "odata",
                        serverPaging: true,
                        serverSorting: true,
                        pageSize: 5,
                        transport: {
                            read: "api/Audit"
                        }
                    },
                    height: 643,
                    pageable: true,
                    scrollable: {
                        virtual: false
                    },
                    sortable: true,
                    dataBound: function(e) {
                        console.log("dataBound");
                    },

                    columns: [
                                    { field: "AUDIT_ID", title: "AUDIT_ID" },
                                    { field: "AUDIT_TYPE", title: "AUDIT_TYPE" },
                    ]
                });
            });
        </script>
        <style>
            /*horizontal Grid scrollbar should appear if the browser window is shrinked too much*/
            #grid table {
                min-width: 1190px;
            }
        </style>
    </div>

 

WebAPI Get method – Case 1

public IQueryable<AUDIT> GetAUDIT()
        {
            return db.AUDIT;
        }


WebAPI Get method – Case 2

public IQueryable<AUDIT> GetAUDIT(int take, int skip, int page, int pageSize)
        {
            return db.AUDIT.Take(take * page).OrderBy(x => x.AUDIT_ID).Skip(skip);
        }

 

In Case 1,
I am receiving all the records irrespective of page size.
Every time, I click on next page, it fetches all records again and shows records from row number 1.

 

In Case 2,
I am able to show only one page size records and it always remains as Page1. I couldn't see multiple pages
These are my requests
http://localhost:49736/api/Audit?take=5&skip=0&page=1&pageSize=5
http://localhost:49736/api/Audit?take=5&skip=5&page=2&pageSize=5

 

Could you please help me on this?

 

Cheers

Sanket

 

Konstantin Dikov
Telerik team
 answered on 28 Jan 2016
1 answer
113 views

I found the "How-To" guide "Use Nested Chart" very helpful for showing how to use kendo widgets inside one or more grid cells.

http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/use-nested-chart

 

I would like to propose adding a note regarding how to cleanup these widgets if the data source changes. Since the "dataBound" event is fired each time the grid is refreshed, the charts are correctly updated. However, previous chart components are not destroyed, potentially leaking data. You can see this behavior by running the example in the dojo. If you put a breakpoint in the kendo chart's destroy() method and then change pages, the breakpoint is not hit.

The solution that I came up with is to also hook the "dataBinding" event and call kendo.destroy() if the action is a "rebind".

dataBinding: function(e) {
    if (e.action === 'rebind') {
        kendo.destroy(e.sender.table.find('tr'));
    }
}

Iliana Dyankova
Telerik team
 answered on 28 Jan 2016
5 answers
165 views

Kendo: v2016.1.112
OS: Windows 10
Browser: Google Chrome (latest: 47.0.2526.111)

There appears to be some quirky behavior with the bullet feature.  If you have some lines of text that are separated by pressing enter (not shift enter), and then do a select all (either from right click context menu or ctrl+A) and then press the bullet formatting button, only the last line will get a bullet.  This behavior is different than selecting all of the text and pressing the bullet formatting button.

This can be repro-ed on the demo page for the editor control

Alex Gyoshev
Telerik team
 answered on 28 Jan 2016
9 answers
185 views

Hi,

Do you have some kind of a calendar which is NOT a date picker ?

Please take a look at http://js.devexpress.com/Demos/Simulator/?url=/Demos/KitchenSink/&deviceMode=mobiles (choose calendar from the menu)

I need a monthly Calendar which is presented on the screen all times , is stretched on the entire width of the device and enables to move between months by swiping.

 

Thx

Sagi

Magdalena
Telerik team
 answered on 28 Jan 2016
1 answer
214 views

Hi,

kendo ui grid does not display correctly in Windows 8.1

winstore-jscompat.js removes all grid cell <td>tags in windows 8.1

This error does not occur in Windows 10

 

thanks

 

 

Alexander Valchev
Telerik team
 answered on 28 Jan 2016
10 answers
1.4K+ views
I'd like to implement the Kendo UI Menu, but I'd like it to open and close only on click events. I need this for 2 reasons:

  1. Click events are in keeping with touch-based devices. While the click functionality works perfectly on an iPad, I'd like it to work the same on PC's.
  2. The developers obviously spent some time to allow us to embed forms, grids, et cetera into a menu item, and it's annoying when someone's working on a form and the menu goes away simply because they moved their mouse.
I'll gladly accept any workarounds, but I believe choosing between hover and click events is a great option to have.
Iliana Dyankova
Telerik team
 answered on 28 Jan 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
ScrollView
Switch
TextArea
BulletChart
Licensing
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?