Telerik Forums
Kendo UI for jQuery Forum
2 answers
259 views

I am trying to change the color of the shape by using the below code. but not working by any way.

please advice what I need to change to set new color to the shape

 

<!DOCTYPE html>
<html>
<head>
</head>
<body>


  <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.common.min.css">
  <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.rtl.min.css">
  <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.default.min.css">
  <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.mobile.all.min.css">

  <script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
  <script src="https://kendo.cdn.telerik.com/2019.1.220/js/angular.min.js"></script>
  <script src="https://kendo.cdn.telerik.com/2019.1.220/js/jszip.min.js"></script>
  <script src="https://kendo.cdn.telerik.com/2019.1.220/js/kendo.all.min.js"></script></head>



<div id="diagram"></div>
<script>
    function createDiagram() {
        $("#diagram").kendoDiagram({
            editable: {
                rotate: false,
                resize: false
            },
            pannable: false,
            zoomMax: 1,
            zoomMin: 1,
            shapeDefaults: {
                visual: visualTemplate,
                connect: false
            },
            connectionDefaults: {
                editable:
                {
                    drag: false
                }
            }
        });
    }

  
  
  function Data() {
        try {
           var diagram_data = $("#diagram").data("kendoDiagram");
           var diagram = $("#diagram").getKendoDiagram();
           diagram_data.dataSource.add({
                                    mac_id: "#12345",
                                    power_of_battry_value: "100",
                                    humidity: "60%",
                                    temperature: "33",
                                   
                                });
          //working fine
          diagram.shapes[0].position(new kendo.dataviz.diagram.Point(50, 50));
                      
           // working fine
          diagram.shapes[0].dataItem.mac_id = "mac_id";
          diagram.shapes[0].dataItem.humidity = "humidity";
          diagram.shapes[0].dataItem.temperature = "temperature";
          diagram.shapes[0].redrawVisual();
         
         
          
          // not working  
          diagram.shapes[0].options.fill.color =  "black";
          diagram.shapes[0].redraw();

          // not working  
          diagram.shapes[0].options.fill.color =  "black";
          diagram.shapes[0].redrawVisual(); 
          
          // not working 
          diagram.shapes[0].redraw({
            fill: {
              color: "black"
            }
          });
          
                       
             
        }
        catch (e)
        { alert(e); }
    }
    $(document).ready(function () {
        createDiagram();
        Data();
    });


    

    function visualTemplate(options) {
        var dataviz = kendo.dataviz;
        var dataItem = options.dataItem;
        
        
        var g = new dataviz.diagram.Group({ id: dataItem.mac_id.trim() } );
        g.append(new  kendo.dataviz.diagram.Rectangle({
            id: dataItem.mac_id.trim(),
            width: 140,
            height: 75,
            x: 0,
            y: 0,
            fill: {
                color: "blue"
            }
        }));

        g.append(new dataviz.diagram.TextBlock({
            text: dataItem.mac_id.trim(),
            x: 10,
            y: 10,
            fill: "#fff"
        }));
        g.append(new dataviz.diagram.TextBlock({
            text: "T: " + dataItem.temperature,
            x: 10,
            y: 25,
            fill: "#fff"
        }));
        g.append(new dataviz.diagram.TextBlock({
            text: "H: " + dataItem.humidity,
            x: 10,
            y: 40,
            fill: "#fff"
        }));
       

        return g;
    }

</script></body>
</html>

Mazen
Top achievements
Rank 1
 answered on 14 Mar 2019
2 answers
229 views

Hello,

After I changed  node's display text in client side the node become not selectable.  for example I have treeview as below: 

$("#treeview").kendoTreeView({
  dataSource: [
    { text: "foo", id:"1", items: [
      { text: "AAA",id:"2" } ] }
  ]
});

I changed "AAA" to "BBB"  by button click (see below code). after that I cannot select that node anymore. the node with 'BBB' function as a LABEL. Does anyone has idea how to resolve it?

 

  $("#btn").click(function(){
     var treeview = $("#treeview").data("kendoTreeView");               
      var myDataItem=treeview.dataSource.get(2); 
      var node = treeview.findByUid(myDataItem.uid);
      node.text("BBB");
      treeview.select(node);
     
 });

Daochuen
Top achievements
Rank 1
Iron
Veteran
Iron
 answered on 14 Mar 2019
3 answers
858 views

I am using kendo grid column editor to get autocomplete values in each cell in a column.

If my selected text is digit, then its selecting [object Object] for the first time and after that if I select again different digit, it will select the digit.

And it doesn't happens with the alphabet/alphanumeric text values.

In the below code, If I am selecting "50", it is giving [object Object].

And if I am selecting Test 65/ Test, it will not change.

And if I add space in text ("50 "), them this value will also not change.

please check and resolve the issue.

 

$('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '"/>')
            .appendTo(container)
            .kendoAutoComplete({
                autoBind: false,
                suggest: true,
                filter: "contains",
                index: 1,
                minLength: 1,
                dataSource: [
                    { text: "50", value: "50"},
                    { text: "60", value: "60" },
                    { text: "Test 65", value: "65" },
                    { text: "Test", value: "23" },
                    { text: "64", value: "64" },
                    { text: "20", value: "20" }
                ]
            });

Dimitar
Telerik team
 answered on 14 Mar 2019
1 answer
1.4K+ views

First question: Can I have multiple create buttons in a Grid toolbar?

Second question: Can the buttons set the value of a column (string value) based on the button pressed).

 

For example, I am trying to use buttons to control if the person being added is a contractor or an employee.  I have a column in my grid called Type (SwitchPersonType in datasource schema) and I want that column to be set based on the button pressed.  Is this possible?

 

Thank you

Eyup
Telerik team
 answered on 14 Mar 2019
1 answer
5.2K+ views
I have a grid that is successfully fetching my json data.  When the grid loads, the data is present but the paging buttons on the lower left do not work and the grid says "No items to display" on the lower right.  If I change the drop down to change the number of items per page, the grid refreshes and the paging works correctly and the number of records are also displayed.  Any ideas?
Viktor Tachev
Telerik team
 answered on 14 Mar 2019
6 answers
2.5K+ views

I initially would have expected that the dataItems() method would have returned the items in the order that they appear in the list box.  However, the method does not.  Are there any plans to change this?  The best work around I can come up with is

var selectCols = $('#list`).data('kendoListBox');

selectCols.items().map(function(i, e) { return selectCols.dataSource.getByUid($(e).data('uid')); })

Is there a better, more durable approach that leverages public API's?

Thanks.

Alex Hajigeorgieva
Telerik team
 answered on 13 Mar 2019
4 answers
439 views

So if in your column specification you specify Locked:true for example

columns: [
{
field: "OrderDate",
title: "Order Date",
width: 180,
locked: true,
lockable: false,
format: "{0:MM/dd/yyyy}"
},
{
field: "ShipCountry",
width: 180,
lockable: false,
title: "Ship Country"
}

]

then you add in multiple selections so

selectable: "multiple, row",

 

Now if you add your change event like this

 

change: function(e) {
var selectedRows = this.select();
alert(JSON.stringify(selectedRows));
},

 

you will see the length will now be double, IE if you select 1 row then the length of selectedRows is 2 with a duplicate entry,  If you remove the locked:true from the column then it gets it correct at 1.  I am guessing it is creating a duplicate locked column etc.

 I have confirmed this on the online examples just adding in this things.

Is this a known bug?

Is this a new bug?

Do you know a way around this so you can actually tell the accurate elements selected?

Viktor Tachev
Telerik team
 answered on 13 Mar 2019
1 answer
359 views

I have a Kendo listbox with a toolbar that allows sorting (up/down) and delete of a list item. When my listbox has enough items that extends it beyond the view of a mobile device, scrolling down causes the toolbar to scroll off screen. Because of this, if a user wants to move the bottom item of the listbox up, they have to scroll down, select the item, then scroll back up to access the toolbar actions, which makes for poor user experience. How can make the toolbar scroll along with list, or even just duplicate the toolbar at the bottom of the list?

 

 

Alex Hajigeorgieva
Telerik team
 answered on 13 Mar 2019
1 answer
280 views

I am using two listboxes, connected with each other, that allow drag and drop between the two. While using the reorder code found in another thread fixes the issue with reordering items within the same list, it doesn't address the issue when dragging and dropping an item from one listbox to the other. I understand that is because this isn't a "reorder" action, it is a "drop" action. I've tried many different angles, like using the "add" event, but there is no "offset" property in the (e) object.

How can I accomplish the same thing, that is, keep the dropped item in the order it is visually dropped?

Eyup
Telerik team
 answered on 13 Mar 2019
18 answers
2.1K+ views

I cannot understand the following sentence from https://goo.gl/q14C6L very well

The dataSource is designed to work with flat (not nested) data. Defining a 'complex' objects in the schema.model is not supported

For this reason I think there is on schema model the from property which allow to rename / alias data fields ( for example from a foreign remote server )

Yes , but if dataSource doesn't support complex object why :

  1. in the schema.model.<fieldN>.type is present a 'object' type ?
  2. in the grid for example is available dot notation to retrieve in some place a nested value on model ?? es: Category.name - is it not in contrast with previous sentence  ?

Also - What is the role of field.type == object during various operation ?? for example if I have a datasource with a field of type object in a grid, it is normally rendered like a string. How is it related to defaultValue ??

So I cannot understand why  documentation is not coherent

 

Thanks

 

Alex Hajigeorgieva
Telerik team
 answered on 13 Mar 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
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?