Telerik Forums
Kendo UI for jQuery Forum
1 answer
224 views
Dear Sir:

I would like to ask a question in kendo controls

when
I filter grid the dropdown auto post back and it doesn't stop on
selected value that i have chosen, so please I need your advice in it.

and here's my Code:
Razor:
@using Kendo.Mvc.UI;
@model IEnumerable<OfferEntityFrameworkDB.OfferDetail>
@{
    ViewBag.Title = "List";
}
<h2>List</h2>

<div>
    @Html.Label("Language:")
</div>
<div>

    @(Html.Kendo().DropDownList()
    .Name("ddlLang")
   .OptionLabel("Please Select Language ...")
    .HtmlAttributes(new { style = "width:200px;" })
    .DataTextField("Name")
    .DataValueField("ID")
    .DataSource(source => source
    .Custom()
    .Transport(transport => transport
    .Read(read =>
      {
          read.Url("ComboRead");
      })).ServerFiltering(false)
      )
        .AutoBind(false)
      .Events(e =>
            {
                e.Change("onChange");
            })
  )

</div>

<br />
<br />
<div>
    @(Html.Kendo().Grid((IEnumerable<OfferEntityFrameworkDB.OfferDetail>)ViewData["OfferData"])
        .Name("grdOffers")
        .Columns(columns =>
        {
            columns.Bound(o => o.OfferID).Hidden();
            columns.Bound(o => o.LanguageID).Hidden();
            columns.Bound(o => o.Name);
            columns.Bound(o => o.Brief);
            columns.Bound(o => o.Desc);
           
columns.Template(c => @Html.ActionLink("Edit", "Edit", new { langId =
c.LanguageID, offerId = c.OfferID })).Title("Edit");
           
columns.Template(c => @Html.ActionLink("Delete", "Delete", new {
langId = c.LanguageID, offerId = c.OfferID })).Title("Delete");
        })
      )

</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
     <script type="text/javascript">
        $(document).ready(function () {
            $("#ddlLang").change(function () {
                var langId = $("#ddlLang").data().kendoDropDownList.value();
                alert(langId);
                var grid = $("#grdOffers").data().kendoGrid;
                if (langId != null || langId != new Guid("")) {
                    grid.dataSource.filter({ field: "LanguageID", operator: "eq", value: langId });
                }
                else {
                    grid.dataSource.filter({});
                };
            });
        });
    </script>
}

Controller:
 public ActionResult List()
        {
            List<OfferDetail> lstOfferDetails =  db.OfferDetails.ToList();
            ViewData["OfferData"] = lstOfferDetails;
            return View(ViewData["OfferData"]);
        }
 public JsonResult ComboRead()
        {

            var lstlanguages = from lan in db.Languages select new { Name = lan.Name, ID = lan.ID };

            return Json(lstlanguages, JsonRequestBehavior.AllowGet);

        }


even sever Controller not working properly when I add data bind to server in the grid.

        List<OfferDetail> lstoffers;
        [HttpPost]
        public JsonResult GetOffersByLangID(Guid? langId)
        {
            lstoffers = (from o in db.OfferDetails where o.LanguageID == langId select o).ToList();
            return Json(lstoffers, JsonRequestBehavior.AllowGet);
        }

Best Regards,
Petur Subev
Telerik team
 answered on 18 Feb 2015
2 answers
710 views
I am new to kendo UI, need your help, please -

I am trying to use kendogrid to create a table. Please see the attached image as an example.  

I have a special requirement - need a summary row always keeps in the first row regardless how the table is sorted. So my questions are:
1. Can I insert a summary row (data is in different format comparing to other rows) into the table?
2. How to keep the summary row always in the first place of the table?
3. The data I loaded from server via Ajax call in the following format, how to split it for the Summary row and the regular row.  
{  
    {"Summary":{"working order": 5, "completed order": 15}},
    {"Details":
     ["User Name": "Jerry", "working order":2,  "Completed order": 10],
     ["User Name": "Peter", "working order":3,  "Completed order": 6]}
}  
** the summary is not sum of the columns. 

If kendogrid doesn't support it, any suggestion for a workaround? 

Thanks,
Jerry
Jerry
Top achievements
Rank 1
 answered on 17 Feb 2015
2 answers
1.0K+ views
I have followed the instructions shown here: http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/editor-templates

When inline editing in the Grid, the combobox renders fine, however the ID/integer of the underlying property is being filled into the textbox/input field regardless of setting .Text to string.Empty and setting .AutoBind to false.  This is very annoying to have a "0" in the user's input area of the combobox.  See code snippets below:

SellerEditor.cshtml

@model object
 
@(Html.Kendo().ComboBoxFor(m => m)
    .DataTextField("SellerName")
    .DataValueField("SellerId")
    .Filter(FilterType.StartsWith)
    .Text(string.Empty)
    .Value(string.Empty)
    .Placeholder("")
    .AutoBind(false)
    .MinLength(1)
    .DataSource(source => source.Read("GetSellerSelectItems", "Now360", new { area = "Admin" }).ServerFiltering(true))
    .HtmlAttributes(new { style = "width: 100%;" })
    .Delay(500))

Main View w/ Grid:

@(Html.Kendo().Grid<VINspinAppsWeb.Areas.Admin.Models.Now360.SellerInterestGridViewModel>()
    .Name("grdInterests")
    .Columns(columns =>
    {
        columns.Bound(m => m.SellerId).Template(@<text></text>).ClientTemplate("#:SellerName#");
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(190);
    })
    .Groupable(grouping => grouping.Enabled(false))
    .Events(events =>
    {
        events.DataBound("onGridInterestsDataBound");
        events.Save("function(e) { kendo.ui.progress($('#grdInterests'), true); }");
        events.Remove("function(e) { kendo.ui.progress($('#grdInterests'), true); }");
        events.Edit("onGridInterestsEdit");
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model =>
        {
            model.Id(m => m.SubscriberSellerInterestId);
            model.Field(p => p.SubscriberSellerInterestId);
            model.Field(p => p.SubscriberId);
            model.Field(p => p.SubscriberSellerId);
            model.Field(p => p.InterestType);
            model.Field(p => p.MakeId);
            model.Field(p => p.SellerId);
        })
        .Events(events =>
        {
            events.Error("onGridError");
            events.Sync("function(e) { kendo.ui.progress($('#grdInterests'), false); }");
        })
        .Read(read => read.Action("SellerInterestsByInterestType", "Now360", new { area = "Admin" }).Data("additionalData"))
        .Update(update => update.Action("UpdateInterest", "Now360", new {area = "Admin" }))
        .Create(create => create.Action("CreateInterest", "Now360", new { area = "Admin" }))
        .Destroy(destroy => destroy.Action("DeleteInterest", "Now360", new { area = "Admin" }))
        .Sort(sort => sort.Add(m => m.SellerName).Ascending())
        .PageSize(10))
    .ToolBar(toolbar => toolbar.Create().Text("New Interest"))
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Filterable(filtering => filtering.Enabled(true))
    .Pageable(paging => paging
        .Enabled(true)
        .Info(true)
        .PageSizes(false)
        .Refresh(true))
    .Scrollable(scrolling => scrolling
        .Enabled(false)
        .Height(400)
        .Virtual(false))
    .Sortable(sorting => sorting
        .Enabled(true)
        .AllowUnsort(false)
        .SortMode(GridSortMode.SingleColumn))
)

ViewModel:
public class SellerInterestGridViewModel
{
    public Guid? SubscriberSellerInterestId { get; set; }
 
    public Guid SubscriberId { get; set; }
 
    [Required]
    public Guid SubscriberSellerId { get; set; }
 
    [Required]
    [UIHint("SellerEditor")]
    [Display(Name = "Seller")]
    public int SellerId { get; set; }
 
    public string SellerName { get; set; }
 
    [Required]
    public short InterestType { get; set; }
 
    public byte? MakeId { get; set; }
}

Bill
Top achievements
Rank 1
 answered on 17 Feb 2015
2 answers
333 views
Hi

I have additional field in my popup. In this case "room". How can I select a default value in the dropdown list?

resources: [
    {
      field: "room",
      defaultValue: 1,
      selected: 1,
      dataSource: [
        { text: "Small meeting room", value: 1 },
        { text: "Big meeting room", value: 2 }
      ]
    }
  ]

http://dojo.telerik.com/OFOKo

Thanks
Markus
Top achievements
Rank 1
 answered on 17 Feb 2015
1 answer
57 views
Hello all,

I am binding the chart to remote data, and the  came up not the way I want it.. I'm not sure how to change thosw "1,1,1,1" into only "1"
Please check the attachemnet for better understanding of the issue I am facing..

Regards,
Iliana Dyankova
Telerik team
 answered on 17 Feb 2015
13 answers
1.8K+ views
When you select and element in the editor the font name and font size in the toolbar display "inherited font" and "inherited size" in their respective toolbar control if that is the default font name and family for the content. How can you remove this so it displays the actual font name and size? This seems like a useless feature, because users don't always know what the default font name/size is and they want to see the actual value not "inherited". That doesn't make sense to me.

Eitherway, how can I remove this inherited value/text so it displays the actual value of the selected item. I see that in the code you always add the "inhertied" option to both of those tools, so how do i remove this functionality?
TiborG
Top achievements
Rank 1
 answered on 17 Feb 2015
4 answers
335 views
Hi Guys!

Since i have upgraded to latest kendo version 2014.1.318 i have noticed on Safari iOS 6.X that every time i open a view from drawer it experiences a double animation of the view. First the view is shown instantly once is loaded and then again the view is shown with a sliding animation. The behavior can also be reproduce on kendo drawer demo sample and on real world web app with more complex views and higher request latency it is even more pronounced. I have also tried setting the Application transition to none and also set transition to none for each view opened from drawer but to no avail, the double animation effect is still experienced. 
I have not experienced this scenario in previous kendo version 2013.3.1324 and as this effect is quite noticeable and affects end user experience i would like to know if it is a known issue and if there is any fix available?

Cheers! 

Mirko
Top achievements
Rank 1
 answered on 17 Feb 2015
1 answer
204 views
Hi,
I have a viewmodel that tracks a "currentAccount" object. This object contains a property of an array called users.
For users property, I am using the data-template to render each record in the array.

Beside each record I will manage show/hide 2 buttons: Remove and Add More. Below the viewmodel and view extracts.

My question is, when a new row is added or one is removed, what's the behavior in rendering the records in the array? Is MVVM framework going to render all items in the array every time a change occurs or will just render the newly added records or remove the ones removed?

The reason why I am asking is because I am trying to track 2 buttons: Remove and Add More.
- Show Remove button only when users' array contain 1 record
- Show Add More button only for the last row rendered

Seems the MVVM framework doesn't re-render entire array when a change occurs. Why? let's see.

1.<button type="button" data-bind="visible: showRemoveBtn, click: removeMore" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
2.<button type="button" data-bind="visible: isLastUser, click: addMore" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>

01.isLastUser: function(e) {
02.    var current_uid = e.uid;
03.    var users_count = this.get("currentAccount").users.length;
04.    var last_user_uid = this.get("currentAccount").users[users_count-1].uid;
05.    return current_uid === last_user_uid;
06.},
07.showRemoveBtn: function() {
08.    return this.get("currentAccount").users.length > 1;
09.},

First row works fine. Remove button is hidden and Add More buttons is shown.
Now, when I press "Add More", a new row is added, Remove & Add More buttons are showing. However, "Add More" button is still showing on the first row as if the "isLastUser" function didn't run for the first row, hence I concluded, the first row was not re-rendered.

How to go around this one?

Thanks
Alexander Valchev
Telerik team
 answered on 17 Feb 2015
1 answer
1.9K+ views
Hi,

I have a Kendo menu that renders on Page Load:

@(Html.Kendo().Menu()
        .Name("AddWidgetMenu")
        .Orientation(MenuOrientation.Horizontal)
        .Items(items =>
        {
            items.Add().Text("Add")
                    .ImageUrl("~/Content/Images/plus.png")
                    .ImageHtmlAttributes( new { width = 20, height = 20 })
                    .HtmlAttributes(new { id = "topWidgetMenuItem" })
            .Items(children =>
            {
                foreach (DashboardWidget widget in Model.AvailableWidgets)
                {
                    children.Add()
                        .Text(widget.Title)
                        .HtmlAttributes(new
                        {
                            widgetid = widget.WidgetId,
                            id = "addWidget" + widget.WidgetId,
                            widgetRequestUrl = Url.Action("_WidgetAdd", "Home", new { widgetId = widget.WidgetId })
                        });
                }
            });
        })
    )

I need to dynamically add new menu links to the menu list which I am able to do, but I cannot figure out how to also include HtmlAttributes so that the menu links work properly.  Please advise:

/*Add widget to menu*/
//initialize the menu widget
$("#AddWidgetMenu").kendoMenu()
// get a reference to the menu widget
var menu = $("#AddWidgetMenu").data("kendoMenu");
var addWidgetRequestUrl = $(contentElement).attr('data-addwidgetrequesturl');
var widgetTitle = $(contentElement).attr('data-title');
var noPrefixWidgetId = widgetId.replace("widget", "");
 
menu.append({
    text: widgetTitle,
    id: "addWidget" + noPrefixWidgetId,
    widgetid: noPrefixWidgetId,
    widgetRequestUrl: addWidgetRequestUrl
    },
    $("#topWidgetMenuItem")
);

The new menu link is added but the HtmlAttributes are being ignored.

<li id="addWidgetUpcomingEvents" class="k-item k-state-default" widgetid="UpcomingEvents" widgetrequesturl="/AppPortal/Home/_WidgetAdd?widgetId=UpcomingEvents" role="menuitem">
<li class="k-item k-state-default k-last" role="menuitem">
<span class="k-link">Recent Sales3</span>
</li>
</ul>
</div>


Thanks,
Mark
Dimo
Telerik team
 answered on 17 Feb 2015
2 answers
203 views
So, I'm attempting to insert a javascript defined elsewhere on a click event in the tooltip as follows:

'<div class="col-md-2"><a onclick=\'jumpme(2,"' + data[0].id+ '");\'>' + data[0].LastName + ' test</a></div>';

in  a content function. If I replace 'jumpme' and the first argument with an alert box, it works fine, but I'm trying to figure out how I can get a function defined elsewhere to fire. The console says the function is undefined, but if I reference it in the row template of the grid that uses this tooltip, it works as expected. How can I get this to fire?
Thanks.
Bryan
Top achievements
Rank 1
 answered on 17 Feb 2015
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
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?