Telerik Forums
UI for ASP.NET MVC Forum
1 answer
114 views

I have been trying to implement a search which search using SSN with and without dashes while using a DropDownList with Virtualization. I have everything working perfectly if you type with the "-" but also want it to work without the "-"

01.@Html.LabelFor(model => model.VisitorID)
02.                    @(Html.Kendo().DropDownList()
03.                      .Name("VisitorID")
04.                      .DataTextField("Value")
05.                      .DataValueField("ID")
06.                      .MinLength(2)
07.                      .HtmlAttributes(new { style = "width:100%" })
08.                      .Height(290)
09.                      .Filter(FilterType.Contains)
10.                      .DataSource(source =>
11.                      {
12.                          source.Custom()
13.                              .ServerFiltering(true)
14.                              .ServerPaging(true)
15.                              .PageSize(80)
16.                              .Type("aspnetmvc-ajax") //Set this type if you want to use DataSourceRequest and ToDataSourceResult instances
17.                              .Transport(transport =>
18.                              {
19.                                  transport.Read("Virtualization_GetVisitor", "Lookups");
20.                              })
21.                              .Schema(schema =>
22.                              {
23.                                  schema.Data("Data") //define the [data](http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.data) option
24.                                        .Total("Total"); //define the [total](http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.total) option
25.                              });
26.                      })
27.                      .Virtual(v => v.ItemHeight(26).ValueMapper("VisitorLookups"))
28.                      .NoDataTemplate("<a onclick=\"addNewEntityPartial(\'Visitor\');\">Add a new Visitor</a>")
29.                    )
30.                    @Html.ValidationMessageFor(model => model.VisitorID)
    
Dhruv
Top achievements
Rank 1
 answered on 10 Jul 2017
3 answers
173 views

Hey guys ,

 When there is a scheduler with options:

 max:date....

selectable:true

if we move a cell down with keyboard and we reach a cell greater then max then scheduler block .

Ivan Danchev
Telerik team
 answered on 10 Jul 2017
4 answers
897 views

I have my customized colors for lines and legend. What I need to know is how can I set the color arrangement for the series color in line chart. As I observed it has their own random arrangement for the colors.

 

My sample array of colors: 

var myColors = ["lightblue", "pink", "yellow", "green", "orange", "red", "teal"];

whenever I load an dataSeries the color will randomly select an color.

I need to set my color per key, for example:

Test 1 = "lightblue", Test 2 = "pink", Test 3 = "yellow"....

 

In the series color defaults will generate colors randomly not based on my customized colors.

Question, is what I need to do to set my customized array of colors?

How can I accomplish this?

 

sample code:

$("#chart").kendoChart({
                title: { text: "MyChart" },
                theme: "Metro",
                dataSource: dataSeries,
                seriesColors: ["lightblue", "pink", "yellow", "green", "orange", "red", "teal"],               
                //seriesColors: myColor,
                series: [{
                    type: "line",
                    field: "value()",
                    categoryField: "Date",
                    name: "#= group.value #",
                    color: "red",
                    markers: {
                        type: 'circle',
                        visible: true,
                        background: 'black',
                        size: 5
                    }
                }],

 

 

Hope to hear from you. I need this to be done as my project is urgent.

Thanks!

 

Regards,

Jerson

Stefan
Telerik team
 answered on 10 Jul 2017
8 answers
138 views

I am using the Example http://demos.telerik.com/aspnet-mvc/grid/hierarchy

 

The Main part of the Grid loads fine but the other one appears to give me a javascript error saying the woid is not defined. Looking at the developer controls in Chrome it also looks like the woid is not being injected.  So I am trying to understand the hashtags and these variables #=woid#   I am looking at .Name("grid_#=woid#") and this is a copy of the demo but using my data. I don't see where the woid data is coming from (on the example this would be the EmployeeID)  some research says that is is related to the CSS, but ther source code does not have any clues to what and how this is used.  

 

@model IEnumerable<GISPortal.GRIDPRINTS>
 
@(Html.Kendo().Grid<GISPortal.GRIDPRINTWO>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(e => e.WOID).Width(110);
            columns.Bound(e => e.REQUESTDATE).Width(110);
            columns.Bound(e => e.NOTIFICATIONTYPE).Width(110);
            columns.Bound(e => e.COMPLETED).Width(110);
            columns.Bound(e => e.ERRORS);
 
        })
        .Sortable()
        .Pageable()
        .Scrollable()
        .ClientDetailTemplateId("template")
        .HtmlAttributes(new { style = "height:600px;" })
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(6)
            .Read(read => read.Action("GRIDPRINTWO_Read", "GridPrint"))
        )
        .Events(events => events.DataBound("dataBound"))
)
 
<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<GISPortal.GRIDPRINTS>()
            .Name("grid_#=woid#") // template expression, to be evaluated in the master context
            .Columns(columns =>
            {
                columns.Bound(o => o.MAPNAME).Width(110);
                columns.Bound(o => o.SCALE).Width(110);
                columns.Bound(o => o.PAGENUMBER);     //.ClientTemplate("\\#= ShipAddress \\#"); // escaped template expression, to be evaluated in the child/detail context
                columns.Bound(o => o.STATUS).Width(300);
                columns.Bound(o => o.ERRORS).Width(300);
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(10)
                                .Read(read => read.Action("GRIDPRINTS_Read", "GridPrint", new { woid = "#=woid#" }))
            )
            .Pageable()
            .Sortable()
            .ToClientTemplate()
    )
</script>
<script>
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
</script>
Viktor Tachev
Telerik team
 answered on 10 Jul 2017
1 answer
549 views

Hi there,

 

I'm creating a custom datasource

01.@(Html.Kendo().Grid<Foo>()
02.    .Name("grid")
03.    .AutoBind(false)
04.    .DataSource(dataSource => dataSource
05.       .Custom()
06.       .Batch(true)
07.       .Schema(s =>
08.         s.Model(model =>
09.         {
10.            model.Id(p => p.ID);
11.            model.Field(x => x.ID).DefaultValue(0);
12.         })
13.       )
14.       .Transport(new
15.       {
16.          read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "customRead" },
17.          create = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "customCreate" },
18.          update = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "customUpdate" },
19.          destroy = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "customDestroy" },
20.       })
21.    )
22.)

 

I need in runtime to change all the transport's handlers (in JavaScript).

I've read the documentation and some posts in the forum but I can't make it work. The last thing I tried was this

 

01.function anotherDestroy(e) {
02.    console.log("calling anotherDestroy()");
03.}
04. 
05.let ds =
06.    $("#grid")
07.        .data("kendoGrid")
08.        .dataSource;
09. 
10.ds.transport.options.destroy = anotherDestroy;

 

Can someone please tell me what I'm doing wrong?

Thank you.

Stefan
Telerik team
 answered on 10 Jul 2017
4 answers
417 views

Hi,

How to set minimum and maximum date range in Line Chart categoryAxis?

Please see min and max in sample code:

 

},
                categoryAxis: {                    
                    min: new Date("6/7/17"),
                    max: new Date("7/7/17"),
                    //type: "date",
                    baseUnit: "days",
                    majorGridLines: {
                        visible: true
                    },
                    labels: {
                        rotation: 40,
                        padding: { right: 10 },
                        dateFormats: {
                            days: "M/d/yy"
                        },
                        step: step
                    }
                }
            });

 

I set it to static, but even if i set it thru var dynamically, same error happens. Please see attached file.

 

 

Daniel
Telerik team
 answered on 10 Jul 2017
2 answers
681 views

Hello,

I need to display a chart binded dynamically with multiple series of the same object type.

I managed to do that using the following chart parameters :

dataSource: {
    data: data,
    group: {
        field: "group"
    }
}

where my data looks like this (this is only an example, data is actually:

var data = [{
    group: "First",
    category: 1,
    value: 100
},
{
    group: "First",
    category: 2,
    value: 200
},
{
    group: "Second",
    category: 1,
    value: 200
},
{
    group: "Second",
    category: 2,
    value: 400
}];

 

However, this structure doesn't suit my other needs (such as displaying a table with one row per group), so I'd like to know if it's possible to display the same chart using data as following :

var data = [{
    group: "First",
    values: [{
        category: 1,
        value: 100
    },
    {
        category: 2,
        value: 200
    }]
},
{
    group: "Second",
    values: [{
        category: 1,
        value: 200
    },
    {
        category: 2,
        value: 400
    }]
}];

 

How can I do that ?

Thanks a lot for your help.

Best regards

Daniel
Telerik team
 answered on 10 Jul 2017
3 answers
502 views
Hi, I was wondering how I could programmatically do this in javascript as I want to make a re-usable javascript function for initializing common grid settings:

.Events(events => events.Change("kendoGridWithCheckboxColumnSelectionOnChange"))
Milena
Telerik team
 answered on 07 Jul 2017
1 answer
2.1K+ views

I have the following textbox defined...

@(Html.Kendo().TextBox().Name("textbox_DataSourceName").HtmlAttributes(new { style = "width:500px;" }))

 

When it's rendered the width does not change, no matter what size I specify.

Stefan
Telerik team
 answered on 07 Jul 2017
5 answers
1.3K+ views
When I change an amount, tick the checkbox etc, it triggers some javascript, which includes some code to set another field on the dataItem, so `dataItem.Set ("Amount", 0);`

I can set it using `dataItem.Amount = 0;` , but then I also need to update the contents of the <td> cell.  When I do set I obviously don't want the dirty flag clearing from other cells, as I haven't clicked 'Save changes' yet, so they are still 'dirty'.

I can't find any documentation on the .set method. It's as though it is firing other events off.

Any advice would be appreciated.

@(Html.Kendo().Grid<OurViewModel>()
.Name("Grid")
.DataSource(dataSource => dataSource
    .Ajax()
    .Model(model =>
    {
        model.Id(a => a.ID);
        model.Field(a => a.Reference).Editable(false);
        model.Field(a => a.Narrative).Editable(false);
        model.Field(a => a.Include).Editable(true);
        model.Field(a => a.Amount).Editable(true);
    })
    .Batch(true)
    .Read(read => read.Action("_Read", "Home"))
    .Update(update => update.Action("_Update", "Home"))
    .ServerOperation(false)
    .Events(events =>
    {
        events.Change("onDataSourceChange");
    })
)
.Columns(columns =>
{
    columns.Bound(a => a.Reference).Title("Reference");
    columns.Bound(a => a.Narrative).Title("Narrative");
    columns.Template(@<text></text>).Title("Include?")
        .ClientTemplate("<input type='checkbox' #= Include ? checked='checked': '' # onclick='updateAmount(this, \"#= ID#\")' />");
    columns.Bound(a => a.Amount).Title("Amount");
})
    .Events(events =>
    {
        events.Save("onSave");
        events.SaveChanges("onSaveChanges");
    })
.ToolBar(toolbar =>
{
    toolbar.Save();
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
)   

and the JS.

function updateAmount(cb, ourID) {
            var checked = $(cb).is(':checked');
            var grid = $('#Grid').data().kendoGrid;
            var dataItem = grid.dataSource.get(ourID);
            dataItem.set("Include", checked);
            if (checked) {
                dataItem.set("Amount", dataItem.get("OriginalAmount"));
            } else {
                dataItem.set("Amount", 0);
            }
       }
Samra
Top achievements
Rank 1
 answered on 07 Jul 2017
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
ComboBox
Upload
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
ColorPicker
DateRangePicker
Security
Wizard
Styling
Chat
DateInput
MediaPlayer
TileLayout
Drawer
SplitView
Template
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?