Telerik Forums
Kendo UI for jQuery Forum
2 answers
365 views

Hi Team, 

To expand on my title, the default value of the 'selectable' attribute is false. However, by accident I discovered, that even if it is false, if you run the select() function on the grid, its default behavior is "multiple,row".

Is this the expected result in this scenario? Personally I would expect there to be no change as i have not specified a selection strategy?

See example, and comment out the selectable attribute: https://dojo.telerik.com/iyaFajoB

Regards, 

Grant

Grant
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 08 Jul 2019
2 answers
1.0K+ views

Hi all,

 

I am looking for a way to put multiples commands buttons, for i.e., "Edit", "Delete", "Print" into one split-button dropdown in Kendo Grid.

 

I've found these buttons here (https://docs.telerik.com/kendo-ui/api/javascript/ui/toolbar/configuration/items.menubuttons) how I wanted but I am not getting the template right for it.

 

The idea is to have a default clickable button to "Edit" and an dropdown arrow to select "Delete" or "Print".

 

Thanks in advance.

Rafael
Top achievements
Rank 1
 answered on 08 Jul 2019
7 answers
127 views

I've been chasing down an elusive problem for some time now and I've narrowed it to a logic change in the ListViewItemBinder.refresh() method between Kendo UI versions 2015.2.902 and 2015.3.930 (the issue happens on every version since 2015.3.930).  We have a mobile list view that is bound to a data source.  The template for the ListView creates a Touch widget and a tap handler for each list item.  The tap events and event handlers are working just fine, within this tap handler we change several properties on the data items within the DataSource.  The issue is that in v2015.2.902 these property changes cause the ListView to refresh itself and properly reflect those property changes, but in 2015.3.930 the ListView does *not* refresh itself even though the code has not changed on our end.

I finally managed to isolate the issue to a logic change within ListViewItemBinder.refresh() between the two versions, specifically within the first "if" block.  Here's the logic in 2015.2.902:

if (action === "itemchange" && !listView._hasBindingTarget()) {
  item = listView.findByDataItem(dataItems)[0];
  if (item) {
    listView.setDataItem(item, dataItems[0]);
  }
  return;
}

In 2015.2.902, action === "itemchange" resolves to true and !listView._hasBindingTarget()) resolves to false, so this block is skipped.  The code eventually drops to the following if/else if/else blocks and eventually calls the very last "else" block which actually triggers the kendo code that re-executes the template and replaces the HTML content (comment is mine):

if (action === "add" && !groupedMode) {
    var index = view.indexOf(dataItems[0]);
    if (index > -1) {
        addedItems = listView.insertAt(dataItems, index);
        addedDataItems = dataItems;
    }
} else if (action === "remove" && !groupedMode) {
    addedItems = [];
    listView.remove(dataItems);
} else if (groupedMode) {
    listView.replaceGrouped(view);
}
else if (prependOnRefresh && !listView._filter) {
    addedItems = listView.prepend(view);
    addedDataItems = view;
}
else {
    listView.replace(view); // <-- This is where the template is re-executed
}

However, in v2015.3.930, the first "if" block I listed earlier was re-written as follows:

if (action === "itemchange") { // action is indeed "itemchange"
    if(!listView._hasBindingTarget()) { // This evaluates to false
        item = listView.findByDataItem(dataItems)[0];
        if (item) {
            listView.setDataItem(item, dataItems[0]);
        }
    }
    return; // We hit this return statement, thus the "refresh" block is never called
}

As I mentioned in the comments, this logic change causes us to immediately hit the "return" statement and we never drop into the lower if/else if/else block where the template gets re-executed.  My questions then are as follows:

  1. What exactly was the purpose of this change?
  2. Is the scenario I've laid out actually exposing a bug, or is there something that I'm doing incorrectly that I can resolve within my own code?

I've tried to mock up this scenario in the Dojo but as of yet haven't quite been able to do it, hence the long post.  Thanks for taking a look!

Boyan Dimitrov
Telerik team
 answered on 05 Jul 2019
2 answers
6.1K+ views

I have a grid with 10000+ items but with the menu filter mode enabled this poses a bit of a lag issue when trying to populate all of the dropdown options for the filter menu.

 

So I use:

filterable: {mode: "menu, row"}

 

Is it possible to have the menu filter mode enabled but disable it on a column by column basis? (See attached image for example of what I mean)

 

As always, thank you for your help.

Jamie
Top achievements
Rank 1
 answered on 05 Jul 2019
4 answers
1.6K+ views

Hello,

After a countless of attempts and adjustements, it is still impossible to retrieve data from a datasource (to load a grid).

I use an API Net.Core that returns JSON (with Odata nugets).

Everything is OK : json is return, callback is triggered (I check with Fiddler 4 of Telerik).

HTML side : I use Odata type for the Transport (I noticed it is impossible to get a callback from my API if I use "webapi" or anything else for instance).

HTML file (body):

<div id="example">
            <div id="grid"></div>
            <script>
   
   $(document).ready(function () {
   
   var dSource = new kendo.data.DataSource({
      type: "odata",
      dataType: "json",
      serverPaging: true,
                        serverSorting: true,
                        pageSize: 12,
      
      transport: {
        read: "https://localhost:44363/api/students"
          
         }
     });
   // read data from the remote service
            dSource.read();
   var data = dSource.data();
   alert(data[0]);
   
   });
           
            </script>
        </div>

 

 

Alex Hajigeorgieva
Telerik team
 answered on 02 Jul 2019
4 answers
2.5K+ views

I'm doing something like this in my css to adjust how the tabs on the render:

.k-tabstrip-items {
align-self: left;
background-color: green;
margin-top: 8px;
margin-bottom: 8px;
height: 32px;
border: 1px solid black !important;
width: 70% !important;
margin-left: 5%;
}

But I need to dynamically adjust the margin so sometimes the tabstrip is centered and sometimes it has the margin above.

So I want to conditionally add something like this:

.k--items-addon {
margin-right: auto;
margin-left: auto;
}

I don't see anything in the API that allows me to pass a class for the  items so that I can dynamically change things in my template or class. Any ideas?

 

Dimiter Topalov
Telerik team
 answered on 02 Jul 2019
5 answers
2.4K+ views

I am returning errors from server and catch it in kendo datasource error event.In this event I am trying to prevent close popup editor, but it works only first time, after clicking update second time, the window closes.
I searched a lot but could not find a solution

 

City = {
    InitializeGrid: function () {
 
        function LoadCities(url, success) {
            Common.serverRequest(url, success);
        }
 
        function UpdateCity(url, params, success) {
            Common.serverRequestParams(url, params, success);
        }
 
        function InsertCity(url, params, success) {
            Common.serverRequestParams(url, params, success);
        }
 
        function DeleteCity(url, id, success) {
            Common.serverRequestParams(url, id, success);
        }
 
        dataSource = new kendo.data.DataSource({
            transport: {
                read: function (e) {
                    LoadCities("/home/read", function (res) {
                        e.success(res);
                    });
                },
 
                update: function (e) {
 
                    UpdateCity("/home/update", e.data, function (res) {
                        var grid = $("#grid").data("kendoGrid");
                        if (res.success) {
                            grid.dataSource.read();
                        } else {
                            e.error("", "", res.error);
                            grid.cancelChanges();
                        }
 
                    });
                },
                create: function (e) {
                    InsertCity("/home/insert", e.data, function (res) {
                        var grid = $("#grid").data("kendoGrid");
 
                        if (res.success) {
                            grid.dataSource.data(res.data);
                        } else {
                            e.error("", "", res.error);
                            grid.cancelChanges();
                        }
                    });
                },
                destroy: function (e) {
                    DeleteCity("/home/delete", e.data, function (res) {
                        var grid = $("#grid").data("kendoGrid");
 
                        if (res.success) {
                            grid.dataSource.data(res.data);
                        } else {
                            e.error("", "", res.error);
                            grid.cancelChanges();
                        }
 
                    });
                }
            },
            error: function (e) {
                var grid = $("#grid").data("kendoGrid");
                grid.one("dataBinding", function (e) {
                    e.preventDefault(); // it occures only first time
                });
                alert(e.errorThrown);
 
            },
            pageSize: 20,
            schema: {
                model: {
                    id: "Id",
                    fields: {
                        Name: { type: "string" },
                        EndDate: { type: "date" },
                        CreateDate: { type: "date" }
                    }
                }
            }
        });
 
        $("#grid").kendoGrid({
            dataSource: dataSource,
            height: 750,
            selectable: "single",
            filterable: true,
            sortable: true,
            pageable: true,
            toolbar: [{ name: "newRecord", text: "New Record" }, { name: "editRecord", text: "Edit REcord" }, { name: "deleteRecord", text: "Delete" }],
            columns: [
                { field: "Name", title: "Name" },
                { field: "EndDate", title: "End Date", format: "{0:dd.MM.yyyy hh:mm}" },
                { field: "CreateDate", title: "Create Date", format: "{0:dd.MM.yyyy hh:mm}" }
            ],
            editable: {
                mode: "popup",
                confirmation: false,
                template: kendo.template($("#popup_editor").html())
            }
        });
 
        $("#grid").on("click", ".k-grid-newRecord", function () {
            Common.gridAdd('grid', 'New Record');
        });
 
        $("#grid").on("click", ".k-grid-editRecord", function () {
            Common.gridEdit('grid', 'Edit Record');
        });
 
        $("#grid").on("click", ".k-grid-deleteRecord", function () {
            Common.gridDelete('grid');
        });
 
    }
}

 

mvc controler

public class HomeController : Controller
    {
        List<City> cities;
        public string error { get; set; }
        public bool isSuccess { get; set; } = true;
         
 
        public ActionResult Index()
        {
            cities = new List<City>();
            Session["city"] = cities;
            return View();
        }
 
        public ActionResult Read()
        {
            var result = (List<City>)Session["city"];
            return Json(result);
        }
 
        public ActionResult Update(City item)
        {
            var result = (List<City>)Session["city"];
 
            if (string.IsNullOrEmpty(item.Name))
            {
                error = "Name is required";
                isSuccess = false;
            }
 
            result.Where(w => w.Id == item.Id).SingleOrDefault(s => s == item);
 
            return Json(new { success = isSuccess, error =error, data = item });
        }
 
        public ActionResult Insert(City item)
        {
            var result = (List<City>)Session["city"];
 
            item.Id = result.Count;
            item.Id++;
 
            if (string.IsNullOrEmpty(item.Name))
            {
                error = "Name is required";
                isSuccess = false;
            }
 
            result.Add(item);
 
            return Json(new { success = isSuccess, error = error, data = item });
        }
 
        public ActionResult Delete(City item)
        {
            var result = (List<City>)Session["city"];
 
            result.Remove(item);
 
            return Json(new { success = isSuccess });
        }
    }
Alex Hajigeorgieva
Telerik team
 answered on 02 Jul 2019
1 answer
3.0K+ views

Hi there,

How do you customise the image on the loading spinner for a Kendo Grid?  I have an animated gif called 'loading.gif' that I wish to use instead of the default image currently.

Thanks, Mark

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 01 Jul 2019
5 answers
507 views

Hello, 

I'm trying to implement kendo ui Scheduler . 
But I realised that when I have many events in the same day I could see only two events and the others are collapsed on "three points".
When I click on the point it redirect me to Day view to see all the planned events.

I really want to remove the Day view and show only Month and Agenda Views.
It is possible to modify the code so when I click on the "three points" it redirect me to the Agenda view or could the Month view be resized dynamically depending on the number of the events ? 
I tried to modify the CSS of the schudeler , but I didn't like the result 

  

<style>
        .k-scheduler-table td, .k-scheduler-table th
        {
          height: 15.5em;
        }
        .k-scheduler-monthview .k-scheduler-table td
        {
          height: 15.5em;
        }
 
 .k-scheduler-timecolumn{
    visibility:collapse !important;
    width:0 !important;
.k-more-events > span {
  margin-top: 0em;
  height: 20px;
}
 
div.k-more-events {
  font-size: 12px;
  height: 20px;
}
.k-scheduler-table td, .k-scheduler-table th {
     height: 1em;
     padding: .334em .5em;
     font-size: 100%;
}
</style>    

 

Thank you in advance, 

Best. 

Ivan Danchev
Telerik team
 answered on 01 Jul 2019
4 answers
635 views
The following code to generate some rectangles with text items (see attached).  What do I need to do to center each text item in its rectangle?  I see there's a Layout, but I'm not sure how to combine rectangles, paths and groups into on of those.

 

var vLines = [5, 90, 175, 260, 345, 430, 515, 600];
var vLines = [5, 90, 175, 260, 345, 430, 515, 600];
 
...
 
$.each(vLines, function (index, value) {
    var group = getBox("line " + count++, "line " + count++, "line " + count++);
    group.transform(geom.transform().translate(10, value));
    surface.draw(group);
});
 
....
 
function getBox(text1, text2, text3) {
 
    var lineColor = "#9999b6";
    var lineWidth = 2;
    var fontNormal = "12px Arial";
 
    var group = new draw.Group();
    var rect = new geom.Rect([0, 0], [160, 75]);
    var path = draw.Path.fromRect(rect, { stroke: { color: lineColor, width: lineWidth } });
    group.append(path);
 
    if (text1) {
        group.append(new draw.Text(text1, new geom.Point(10, 10), { font: fontNormal }));
    }
 
    if (text2) {
        group.append(new draw.Text(text2, new geom.Point(10, 30), { font: fontNormal }));
    }
 
    if (text3) {
        group.append(new draw.Text(text3, new geom.Point(10, 50), { font: fontNormal }));
    }
             
    return group;
}

 

 

Thanks

Alex Hajigeorgieva
Telerik team
 answered on 01 Jul 2019
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
Drag and Drop
Map
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
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?