Telerik Forums
Kendo UI for jQuery Forum
19 answers
2.8K+ views
I have an application that has one split window where side A is a GoogleMap and side B is a Grid.
The grid is selectable:"multiple, row", and selections show small red footprints on the map when the item in the row is selected (in other words, item select in the grid will show up as a red bounding box in the map).

All this is working fine.

But sometimes the row-item selected is off screen on the map, and USERS are asking for the the ability to "click" on a row and have the map window scroll to center on that item.

Since row select (and thus <TR onclick() > is being used I was considered using jQuery to add:

$("#grid tr[data-uid]").dblclick( function(e) {panTo(e)});

To each of the 500+ data rows in the Grid (I have group headings also). I could also handle .keypress().

1 is this nuts, or is there more efficient or better way to do this? (i.e some sort of custom row editor? even though the grid is read-only)?
2. Which is better doubleclick or keypress?

Dimiter Topalov
Telerik team
 answered on 16 Dec 2016
2 answers
650 views

We made a responsive grid using CSS breakpoints, some columns are hidden in small resolution screens, when i export to PDF the file only shows columns showed in browser as a print screen, there is a way to print all columns???

thanks in advance!

Ismaelc
Top achievements
Rank 1
 answered on 15 Dec 2016
3 answers
650 views

I am using angularjs and have a kendo grid defined as follows

 MVC View

<div id="cumulativeResultView" class="txtLeft" ng-show="currentTab === 'cummulativeView'">
        <div id="clinReportContainer" >
            <div id="kendoGrid" kendo-grid k-options="resultGridOptions" k-rebind="resultGridOptions"
                  style="height:550px; width: 600px;margin-top:45px"></div>
        </div>
    </div>
    <script id="clinReportCellTemplate" type="text/x-kendo-template">
        <span class='ellipsisTxt'>
            #=testCode{0}.result ? testCode{0}.result :'' #
            <span ng-show="showUnits(dataItem, '#=testCode{0}.testCode#') ">#=testCode{0}.units#</span>
        </span>
    </script>

angular controller

01.$scope.showUnits = function (dataItem, testCode) {
02.    if (dataItem['testCode' + testCode] !== undefined)
03.        return dataItem[testCode].units === 'N';
04.    else return false;
05.}
06.var gridColumns = [
07.    {
08.        field: 'collectDate',
09.        title: 'Collect Date',               
10.        locked: true,               
11.        width: '150px'
12.    },
13.];
14.angular.forEach(uniqueTestCodes, function (testCode, key) {
15.    gridColumns.push({
16.        field: 'testCode'+testCode,
17.        title: testCode,
18.        template:kendo.format($('#clinReportCellTemplate')[0].innerHTML,testCode),
19.        width:'120px'
20.    });
21.});
22. 
23.$scope.reportGridData = gridData;
24.$scope.resultGridOptions = {
25.    dataSource: { data: gridData },
26.    columns: gridColumns,
27.};

 

When the locked property is set on the Collect date column, the grid contents are minimized and when the page is resized, the unlocked columns size appropriately, but the locked column shows no data. If I remove the locked property the gird displays as expected. What do I need to do to get the locked column to behave?

Gaurav
Top achievements
Rank 1
 answered on 15 Dec 2016
1 answer
73 views

In this example: http://jsfiddle.net/pmgkpgp0/

When I scroll content on background down and click on it and then I click on kendo window, content on background moves up. This problem occurs when I set value pinned: true

How to solve this problem?

Ianko
Telerik team
 answered on 15 Dec 2016
1 answer
328 views

I have two sortable divs, configured to allow me to drag element from div A to div B. Working great. The only thing is, my element disappears from div A when I drag it to div B. How can I prevent the element from being removed from div A?

Thanks in advance!

 

For reference, below is my code instantiating the sortables:

$("#leftSide").kendoSortable({
    cursor: "move",
    connectWith: "#rightSide",
    placeholder: placeholder,
    hint: hint
});
 
$("#rightSide").kendoSortable({
    cursor: "move",
    placeholder: placeholder,
    hint: hint,
    start: function (e) {
        if (isResizing) {
            e.preventDefault();
        }
    },
    change: function (element, ui) {
        element.item.height(90);
        var myWidth = element.item.width();
        element.item.width(myWidth - 10);
    }
});
Stefan
Telerik team
 answered on 15 Dec 2016
4 answers
1.0K+ views

I have a Kendo TreeView where I need to programmatically reload the items via dataSource.read(), then after that, automatically expand down to and select the item that was selected before the read().  I have tried everything I can find via Google, and I just can't seem to make it work (neither the expand nor the select works). 

Here's what I have so far:

var componentTreeView = $("#componentTreeView").data("kendoTreeView");
var selectedNodeElement = componentTreeView.select();
var selectedNode = componentTreeView.dataItem(selectedNodeElement);
var id = selectedNode.id;
 
componentTreeView.dataSource.read();
 
// get DataSourceItem by given id
var nodeDataItem = componentTreeView.dataSource.get(id);
 
//get node within treeview widget by uid
var node = componentTreeView.findByUid(nodeDataItem.uid);
var dataItem = componentTreeView.dataItem(node);
componentTreeView.expandTo(dataItem);
componentTreeView.select(dataItem);

 

I have tried every combination I can think of of using the nodeDataItem, the node, and hte dataItem (I think nodeDataItem and dataItem are the same thing, right?  But I got the code from several different examples and was just trying to be thorough). 

Also, I have a feeling I need to use expandPath(), but literally every example code I could find for expandPath just provides a hard-coded list of ids (like "[1, 4, 5]" which is completely useless to me.  How do I get the ids for each parent I need, in order to use expandPath?  Or is that even what I need to do? 

I also saw one example that did the following:

var item = $("#componentTreeView").find("li[data-id='" + id + "']").find(".k-in");
 
// expand all parent nodes
$(item).parentsUntil('.k-treeview').filter('.k-item').each(
    function (index, element) {
        $("#componentTreeView").data('kendoTreeView').expand($(this));
    }
);

 

But this did not work either. 

Peter Milchev
Telerik team
 answered on 15 Dec 2016
2 answers
157 views

Hi,

I am trying a very basic thing but cannot find the right option. I would like to have something like a "live-ticker" chart which shows the last(est) x values (just numbers). When I use a DataSource with my sparkline chart I can add records and togehter with categoryAxis.min=0 and categoryAxis.max=16 I get the first 16 values display but not the last 16 values. How can I achieve this?

There is a DataSource.remove but it requires to give a certain object. Is there an index-based remover? Is there a better approach?

Also to make it more advanced I would like not to hardcode the maximum number of values displayed but have it depend on the available space (if the chart is big enough for 100 values, lets show 100 - if smaller then fewer). I know if I make the chart bigger on-the-fly that additional values might not be there yet but that would be okay - the graph can fill with time.

This is like show a value every second.

Best regards,
Ricky

Ricky
Top achievements
Rank 2
 answered on 15 Dec 2016
6 answers
366 views
I am creating a IEnumerable of TreeViewItemModel on the server side and passing it to the treeview.

@(Html.Kendo().TreeView()
        .Name("treeview")
        .DragAndDrop(true)
        .BindTo(Model.TreeViewItems)
        .Events(events => events
            .Drop("onDrop")
        )
    )

I have added custom attributes to the items but they not rendered.

item.HtmlAttributes.Add(new KeyValuePair<string,string>("data_owner", resource.OwnerId.ToString())); 

What am I doing wrong?

It would also be nice if all attributes including ID did not disappear following drag and drop!
Vangel
Top achievements
Rank 1
 answered on 15 Dec 2016
12 answers
1.3K+ views

Hello!

I am using a Kendo ToolBar widget as the toolbar for a Kendo Grid with a custom button to export the grid data as a MS Excel file. The custom button uses the CSS class "k-grid-excel" in order to implement the Excel functionality automatically.

The documentation (http://docs.telerik.com/kendo-ui/controls/data-management/grid/excel-export) says that "The Grid uses the current column order, visibility, and dimensions to generate the Excel file.", which works as expected as long as I do not use grid persist state functionality.

However, when I preserve the grid state, then restore it, then click on the export button, the generated Excel file does not use the current column order and visibility. I wanted to reproduce the problem in your online example (http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/state/preserve-grid-state-in-a-cookie), but unfortunately the preview and the Dojo do not work as expected, although your other online examples work.

I have found out that export after restoring the grid state works as expected (column order and visibility) if I use the saveAsExcel() method instead of having a button with the "k-grid-excel" CSS class. Do you have any idea, why these two are behaving differently?

I also want to remark that I detach the toolbar DOM, restore the grid state, and then insert the toolbar DOM back to the grid. I am also using the MVC Wrappers, but I think the problem applies to Kendo UI Grid in general.

 

Best regards,

Kaan

 

 

 

http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/state/preserve-grid-state-in-a-cookie

Dimiter Madjarov
Telerik team
 answered on 15 Dec 2016
1 answer
668 views

Hello,

I have a quite complex drag&drop scenario:

 

  •  2 grids with different column structure
  • multiselect
  • move rows between the grids
  • move rows inside the same grid (reordering)
  • dropping rows on an empty grid 
  • dropping rows to be inserted after the position of the row where the drop happened

 

After some testing I found a solution which works quite good. But strangely just when I load the test application from a local test web server.
If I install the application on a remote Web Server the identification of the grid row where the drop occured fails. I stripped down everything
which does not belong to that problem (for example angularjs to have the same behaviour jQuery based). Here is the reduced code. To even
exclude the possibility that it could have to do something with my eval version of kendo I used the libraries from CDN.

 

  • Are the 2 methods which I use to get the uid of the drop row at all recommended?
  • Is there a reliable way to get the uid of the drop row?
  • I assume some type of run time problem here but the behaviour is stable (local server works always, remote server never).

Can be tested here:     http://medialan.de:9800/dragdroptest.html

On dojo the code is working!

 

<!DOCTYPE html>
<html>
  <head>
    <link href="../kendo/styles/kendo.common.min.css" rel="stylesheet" />
    <link href="../kendo/styles/kendo.rtl.min.css" rel="stylesheet" type="text/css" />
    <link href="../kendo/styles/kendo.default.min.css" rel="stylesheet" />
    <link href="../kendo/styles/kendo.default.mobile.min.css" rel="stylesheet" type="text/css" />

    <script src="../kendo/js/jquery.min.js"></script>
    <script src="../kendo/js/kendo.all.min.js"></script>

    <script>
      $(function() {
        var d = [
          { v : "a" },
          { v : "b" },
          { v : "c" }];
  
        var grid = $('#grid').kendoGrid({          
          dataSource: new kendo.data.DataSource({ data: d }),
          selectable : "row",
          columns: [ { field: "v" } ]        
        }).data('kendoGrid');
        
        grid.table.kendoDropTarget({
          drop: function(e) {
            e.draggable.hint.hide();        
            
            // dropuid is undefined, when providing the test from a remote server
            // - e.target is div.k-grid.k-widget  when using remote server
            // - e.target is td when using a local server
            
            var dropuid = $($(e.target).parent()).data("uid");            
            console.log('dropuid is: ' + dropuid);
            dropuid = grid.dataItem(e.target.closest("tr")).uid;
            console.log('dropuid is: ' + dropuid);
          }
        });

        grid.table.kendoDraggable({
          filter: "tbody > tr",                         
          cursorOffset : { top: 1, left: 1},       
          hint: function(e) {
            return $('<div class="k-grid k-widget"><table><tbody><tr>' + e.html() + '</tr></tbody></table></div>');
          }
        });
      });
    </script>
  </head>

  <body>
    <div id="grid"></div>   
  </body>
</html>

 

Boyan Dimitrov
Telerik team
 answered on 15 Dec 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
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
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?