Telerik Forums
UI for ASP.NET MVC Forum
2 answers
146 views

Is there any way to detect an event AFTER an item has been added to a ListBox? The existing add event fires before the item is added.

My use case is that I have two connected ListBoxes. The second listbox contains a template that I need to run some jQuery in to modify the contents based on the item data, so the item needs to have been created before the script is run?

Ian
Top achievements
Rank 1
 answered on 07 May 2019
3 answers
497 views

I have a drop down that responds to type-ahead. If I have a list of items 'Aitem, Bitem, Citem' and I type in the dropdown 'C' I get the input box filled in with 'Citem'. That works just fine. Is what I want is if 'Citem' is in the drop down list and focus is lost an 'automatic' selection occurs. From various documentation I have come up with

        var wrapper = kendoDropDownList.wrapper;
        wrapper.blur(function (e) {

// What goes here?

        });

I have found that this function does get called when I lose focus and the argument 'e' is not undefined. But I am not sure how to get what is in the input box currently or a reference to the dropdown options. Any idea how I would do that?

 

Thank you.

Veselin Tsvetanov
Telerik team
 answered on 07 May 2019
3 answers
1.1K+ views
How can I set a field in the popup editor to use a multiline textarea instead of an input tag?
Georgi
Telerik team
 answered on 07 May 2019
10 answers
1.5K+ views
Right now the scrollbar is only visible on the bottom of the grid page. So this means if there are more columns that can be displayed (needs to scroll) the user must scroll down to the bottom of the page and move the horizontal scrollbar then scroll back up to see the additional columns. Is there a way to allow for horizontal scrolling at the top AND bottom of the page?
Alex Hajigeorgieva
Telerik team
 answered on 06 May 2019
1 answer
273 views

I have a view that has several tabs.  Each tab has a Telerik MVC grid on it.  The grid on the first tab displays a scroll bar as it should, but the grids on the other tabs do not display the scroll bar unless I reload the grid when visible or click on "Cancel Changes" or "Clear Filters".   I have tried the $("#MyGrid").getKendoGrid()._rowHeight = null; suggestion, but it did not work and I do not want to reload the grid each time the user navigates to the tab or to grammatically click the Cancel Changes or Clear Filters buttons as those are hacky solutions.

The grids use scrollable.Virtual(true) and scrollable.Height("auto").  

Is there something I can call in my javascript when the tab is selected and the grid is visible to cause the scroll bars to appear other then what I have previously mentioned?

Thanks.

Preslav
Telerik team
 answered on 06 May 2019
1 answer
693 views

I have a two Switch widgets on my page and have a change event setup for one of them. In the change function i'm trying to get a reference to the other switch on the page to see if it is checked. All I get is 'Undefined'.

<div class="col-md-6">
        <div class="form-group pt-2">
            @(Html.Kendo().Switch()
                  .Name("Immediate")
                  .Messages(c => c.Checked("YES").Unchecked("NO"))
                  )
            <label for="reportable">Save changes immediately</label>
        </div>
        <div class="form-group">
            @(Html.Kendo().Switch()
                  .Name("Scheduled")
                  .Messages(c => c.Checked("YES").Unchecked("NO"))
                  .Events(e => e.Change("onScheduledChange"))
                  )
            <label for="history">Schedule/Back-Date Changes</label>
        </div>
    </div>

and here's my JS:

<script>
    function onScheduledChange(e) {
        var immediateSwitch = $("#Immediate").checked;
        if (e.checked) {
            //alert("scheduled is checked");
            alert(immediateSwitch);
        }
    }
</script>

immediateSwitch returns undefined.

I've also tried this:

<script>
    function onScheduledChange(e) {
        var immediateSwitch = $("#Immediate").data("kendoSwitch");
        if (e.checked) {
            //alert("scheduled is checked");
            alert(immediateSwitch.checked);
        }
    }
</script>

 

and got the same results. How do you get a reference to another Switch on the page??????

 

 

 

Preslav
Telerik team
 answered on 06 May 2019
4 answers
1.3K+ views
Hi there,


I just moved from Telerik MVC to Kendo. Quite a learning curve.

I'm having a strange problem, where I have set sort on the DataSource, the data being sorted correctly, just the sort icon doesn't show up on the column header, see attached thumbnail, .

javascript
standardGrid.dataSource.sort({ field: "ProjectName", dir: "dsc" });

Grid
@(Html.Kendo()
.Grid<CorporateSys.Data.GetProjectsByIdBusinessUnitIdsUserIdTagged_Result>()
.Name("ProjectStandardGrid")
.HtmlAttributes(new { style = "display:inline-block; height:100%; clear:both;" })
.Columns(columns =>
{
    columns.Bound(c => c.ProjectId).Hidden();
    columns.Bound(c => c.ProjectName);
    columns.Bound(c => c.ProjectType);
})
.Filterable()   
.Groupable()
.Sortable()
.DataSource(ds => ds.Ajax()
    .Read("GetJobs", "Job", new { isBau = Model.IsBau, clientId = Model.ClientId })
                                    .ServerOperation(true)
    .PageSize(20))
    .Events(events=>events.DataBound("OnStandardGridDataBound")) 
.Pageable()
)


I tried to hack the sort icon in databound event as following. After grid loaded, I click on column header, I always get two sort icons, see attached 'duplicate sort icons'. I tried to append "<span class='k-icon k-i-arrow-n'></span>",  the icon does not show. I tried "<span class='k-icon'></span>", but it displays two icons.

Hack in databound event
function OnStandardGridDataBound(e) {
    var grid = $("#ProjectStandardGrid").data("kendoGrid");
 
    var th = grid.thead.find(".k-link");
 
    th.find('span').remove();
 
    var sortSettings = grid.dataSource._sort;
 
    if (sortSettings != "" && sortSettings != null) {
        for (var i = 0; i < sortSettings.length; i++) {
            var sort = sortSettings[i];
 
            var thSort = grid.thead.find("th[data-field='" + sort.field + "'] .k-link");
 
            if (sort.dir == "dsc") {
                //thSort.append("<span class='k-icon k-i-arrow-n'></span>"); //k-i-arrow-s
 
                thSort.append("<span class='k-icon'></span>"); //k-i-arrow-s
       
            } else if (sort.dir == "asc") {
 
                thSort.append("<span class='k-icon'></span>"); //k-i-arrow-s
            }
        }
    }

any suggestion?

thanks in advance


regards
Jerry
Christos
Top achievements
Rank 1
 answered on 05 May 2019
2 answers
392 views

Hi,

I would like users to direct to new pages/controllers when they click on different pieces of pie chart.

I found something similar https://www.telerik.com/forums/pie-chart-with-link but its related to RadCharts and not Kendo.

Can you please provide a code snippet or link to docs.

I tried using parameter like url but that didnt work.

 @(Html.Kendo().Chart()
                            .Name("chart")
                            .Title("Big Players")
                            .Legend(legend => legend
                                .Position(ChartLegendPosition.Bottom)
                            )
                            .Series(series =>
                            {
                                series.Pie(new dynamic[] {
new {category = "Apple",value = 40.3, color = "#ff3d00", url = "https://www.apple.com"},
new {category = "Microsoft",value = 0.4, color = "#f3e5f5", url = "https://www.microsoft.com"},
new {category = "IBM",value = 40.6, color = "#304ffe", url = "https://www.ibm.com"}

})
                                .Labels(labels => labels
                                    .Visible(true)
                                    .Template("#= category # - #= kendo.format('{0:P}', percentage)#")
                                );
                            }))

 

Thank you

StuartLittle
Top achievements
Rank 1
 answered on 03 May 2019
4 answers
307 views

Hi folks,

I'm running the Grid SignalR example (found here http://demos.telerik.com/aspnet-mvc/grid/signalr) locally.

Even though it is running locally, the sample still fetches data from the Web, instead of my local machine as in:

 var hubUrl = "http://demos.telerik.com/kendo-ui/service/signalr/hubs";

I want to run this entirely locally. I'm getting data from the local backend data service by running the code found here on my machine:

https://github.com/telerik/kendo-ui-demos-service

However, I'm stuck at what route on my local system replaces http://demos.telerik.com/kendo-ui/service/signalr/hubs

Would the local route be

var hubUrl = http://localhost:42471/hubs;

How do I set the route?

Thanks,

Ken

Konstantin Dikov
Telerik team
 answered on 02 May 2019
3 answers
1.1K+ views

I developed a Grid which displays a pop-up for updates. Popup Edit screen is a Custom template with a dropdown list that calls the controller to populate the dropdown. In this case, i am populating the prefixes. The is populated fine, but when I click on a row on the grid to edit an item, I need to pre-select the value in the drop-down. let's say if a particular row has a value of "Mr." as a prefix, I need it to be pre-selected in the popup .

 

If the use of a  @Html.EditorFor(model => model.Prefix), it perfectly populates the editor fine. This doesn't work for Dropdown.

 

The editor template is called MemberEdit and the code in it is as below:

<p></p><p>@model <g class="gr_ gr_98 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="98" data-gr-id="98">Api</g>.<g class="gr_ gr_162 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation multiReplace" id="162" data-gr-id="162">Common..</g>Models.WebUser<br><br>    <div class="row" style="margin-left:5px;"><br>        <div class="col-lg-2"><br>            @Html.LabelFor(model => model.Prefix)<br>            @*@Html.EditorFor(model => model.Prefix)*@<br>            @(Html.Kendo().DropDownList()<br>                      .Name("ddlPrefix")<br>                      .DataTextField("Prefix")<br>                      .DataValueField("PrefixKey")<br>                      .DataSource(source =><br>                      {<br>                          source.Read(read =><br>                          {<br>                              read.Action("ListCustomerPrefix", "Home"); //.Data("additionalPrefixData");<br>                          })<br>                          .ServerFiltering(true);<br>                      })<br>                      //  .Text(Model.Prefix)<br>                      .Value(Model.PrefixKey)<br>                      .AutoBind(false)<br>                      .HtmlAttributes(new { style = "width: 100%" })<br>            )<br>            @Html.ValidationMessageFor(model => model.Prefix)<br>        </div><br>    </div></p>


The Grid code is as shown below: 

1.  @(Html.Kendo().Grid<.Api.Common..Models.WebUser>()<br>            .Name("membersGrid")<br>            .Columns(columns =><br>            {<br>                columns.Command(command => { command.Edit(); command.Destroy().Text("Del"); }).Width("15%");<br>                columns.Bound(p => p.CST_KEY).Visible(false);<br>                columns.Bound(p => p.FullName).Width("20%").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains").SuggestionOperator(FilterType.Contains)));<br>                columns.Bound(p => p.Role).Width("25%").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains").SuggestionOperator(FilterType.Contains)));<br>                columns.Bound(p => p.Title).Width("20%").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains").SuggestionOperator(FilterType.Contains)));<br>                columns.Bound(p => p.EmailAddress).Width("20%").Filterable(ftb => ftb.Cell(cell => cell.Operator("contains").SuggestionOperator(FilterType.Contains)));<br>                columns.Bound(p => p.Prefix).Visible(false);<br>                columns.Bound(p => p.Suffix).Visible(false);<br>                columns.Bound(p => p.RoleKey).Visible(false);<br>                columns.Bound(p => p.OrganizationMemberKey).Visible(false);<br><br>            }).Filterable(filterable => filterable<br>              .Extra(false)<br>              .Operators(ops => ops<br>                  .ForString(str => str.Clear()<br>                       .Contains("Contains")<br>                       .StartsWith("Starts With")<br>                       .IsEqualTo("Is Equal To")<br>                       .IsNotEqualTo("Is Not Equal To")<br>                      )))<br>            .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("MemberEdit").Window(w => w.Title("Edit Employee").Width(1100)))<br>            .Pageable(pager => pager.AlwaysVisible(false).PageSizes(new List<object> { 5, 10, 15, 20 }))<br>            .Sortable()<br>            .Filterable(ftb => ftb.Mode(GridFilterMode.Row))<br>            .HtmlAttributes(new { style = "width:100%;" })<br>            .DataSource(dataSource => dataSource<br>                .Ajax()<br>                .PageSize(10)<br>                .Events(events => events.Error("error_handler"))<br>                .Model(model => model.Id(p => p.CST_KEY))<br>                .Read(read => read.Action("ListMembers", "Home"))<br>                .Update(update => update.Action("EditingPopup_Update", "Home"))<br>                .Model(model =><br>                {<br>                    model.Field(m => m.Title);<br>                    model.Field(m => m.Prefix);<br>                    model.Field(m => m.PrefixKey);<br>                    model.Field(m => m.Suffix);<br>                    model.Field(m => m.FirstName);<br>                    model.Field(m => m.MiddleName);<br>                    model.Field(m => m.LastName);<br>                    model.Field(m => m.OrganizationKey);<br>                    model.Field(m => m.FullName);<br>                    model.Field(m => m.CustomerId);<br>                    model.Field(m => m.OrganizationMemberKey);<br>                    model.Field(m => m.EmailAddress);<br>                    model.Field(m => m.CST_KEY);<br>                    model.Field(m => m.Role);<br>                    model.Field(m => m.RoleKey);<br>                    model.Field(m => m.RoleList).DefaultValue(new List<Aamva.Api.Common.WebSite.Models.WebUserRole>());<br>                }<br>                )<br>             )<br>    )

 

The Model is as below:

   public class WebUser<br>    {<br>        public string CST_KEY { get; set; }<br>        public string EmailAddress { get; set; }<br>        public string Prefix { get; set; }<br>        public string PrefixKey { get; set; }<br>        public string Suffix { get; set; }<br>        public string Title { get; set; }<br>        public string FirstName { get; set; }<br>        public string MiddleName { get; set; }<br>        public string LastName { get; set; }<br>        public string OrganizationKey { get; set; }<br>        public string OrganizationMemberKey { get; set; }<br>        public string OrganizationName { get; set; }<br>        public string Role { get; set; }<br>        public string RoleKey { get; set; }<br>        public List<WebUserRole> RoleList { get; set; }<br>   

}

 

The Model for Prefix is as below:

    public class WebUserPrefix<br>    {<br>        public string PrefixKey { get; set; }<br>        public string Prefix { get; set; }<br>    }

 

 

 

Preslav
Telerik team
 answered on 01 May 2019
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
Dialog
MultiColumnComboBox
DropDownTree
Checkbox
Slider
Switch
Notification
Accessibility
ListView (Mobile)
Pager
Security
ColorPicker
DateRangePicker
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
DropDownButton
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
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
SmartPasteButton
PromptBox
SegmentedControl
LLM Kit
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?