Telerik Forums
Kendo UI for jQuery Forum
6 answers
392 views

This is my destroy function:

destroy: function (e) {

               console.log(e.data);

                api.post("api/myservice/Remove", e.data)
                         .then(
                          function success(response) {
                                 $('#grid').data('kendoGrid').dataSource.read();
                          },
                          function error(response) {
                           });
               }

Whenever I delete a row (let's say e1), any other future action (create/update/destroy) I do will trigger the deletion of e1 AGAIN. So if I create a new row, it would create the row (call the create function) AND delete the e1 row (which doesn't exist anymore, but somehow the value of e.data still remains). The deletion chain is cumulative, so if I were to delete a row e2, and then perform an action, then I would get a deletion of e1 and e2 AGAIN.

Anyone know what the problem is??

Boyan Dimitrov
Telerik team
 answered on 12 Feb 2016
5 answers
409 views

I need a bit of guidance on Treeview. My hierarchical datasource makes an ajax call to a webservice that returns a NULL on he first node of the tree. There is a reason for this because the Parent is the node represents the name of the actual Tree. Each subsequent node is the actual tree nodes. Also the JSON object returned is a nested, Complex object.

 Here is an example: 

{"id": 1, "isSSMNameNode": true, "tgtWeight": 0.0, "currWeight": 0.0, "hasChildNode": true, "ext_model_id": 1, "parent": null, "SSM": {"id": 1, "securitySelectionModelName": "vincent", "userCreatedModel": "[{\"classificationName\":\"vincent\",\"id\":1,\"expanded\":true,\"hasChildNode\":true,\"child\":[{\"classificationName\":\"MBS\",\"id\":14,\"expanded\":true,\"hasChildNode\":true,\"child\":[{\"classificationName\":\"Money Market\",\"id\":17,\"hasChildNode\":false}]}]}]", "classificationNames": []}, "classificationNameNode": null}

 

I've tried to use Schema.parse to make the nodes into a flat object but for some reason I lose the tree hierarchy when I try to do: 

 

var node = {
..
hasChildren = response.hasChildNode;
..
}
 

For some reason the hasChildren disappears from the node object  so that didn't work for me. Any ideas on how to get the first node to produce some value from the object and then have the name from the subsequent JSON object return?

 

What w 

 

 

Alex Gyoshev
Telerik team
 answered on 12 Feb 2016
5 answers
146 views

Hello Guys, 

I have a question about how the logic of the drawing of each step is done and why is the point rendered at the middle of the step.

I have an urgent problem that need to be implemented and i have to achieve something like this: highcharts example.

In this dojo example i used the basic step example with the points of the steps being rendered in the middle of each step. To be more precisely i want the step to point at the start of each step, or any other solution that may work.

 

Please help me with this one,

Thank's in advance.

Dragos
Top achievements
Rank 1
 answered on 12 Feb 2016
3 answers
555 views

Using the column filter itemTemplate, I can use this to specify the item template inline (using #=data.country# and e.field). How can I achieve the same using kendo.template?

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.filterable.itemTemplate

Thanks,

--Ed

Plamen
Telerik team
 answered on 12 Feb 2016
2 answers
143 views
Hello,
What is event keypress?
Konstantin Dikov
Telerik team
 answered on 12 Feb 2016
1 answer
383 views

We had some support from the Telerik team about a year ago when we wanted to split a connecting label over multiple lines. At the time, they advised us of a bug and gave us a workaround.

We've just had to update to the latest version of the Kendo UI js file to fix another bug related to a JQuery update, and it has broken our workaround. The original fix was to replace the standard text in the box, and add it into a tspan. Following the update, this now renders the tspan on the diagram following the new update. I've attached a screen of how it showed before, with the workaround, and how it shows now following the update.

The current value in the DescriptionForKendo field:

<tspan x="0" dy="0em">Class A, 50 Shares</tspan><tspan x="0" dy="1em">Class B, 100 Shares</tspan>

The binding of the field to the view:

.ConnectionDefaults(cd => cd.Editable(false).Content(o => o.Template("#= dataItem.DescriptionForKendo #"))

Any ideas if this was specifically catered for in the latest version, or how we can add a line break into a connecting label now?

 

T. Tsonev
Telerik team
 answered on 12 Feb 2016
1 answer
314 views

I am trying to export a MVC page to a pdf file.  Following are some of the issues I am facing in order to do a PDF Export:

 Issue1:  While this works well, the first issue is that it exports to a single pdf page.  However I understand that if I move the paperSize and margin options to drawDOM then multipage export works fine but all the selected mvc radiobuttons on the page gets cleared.
Though the radiobutton selection shows the selected value in the pdf, it gets cleared off the page.  This only happens when I move the pagesize and margin options to drawDOM.  The selection is retained when those options are added to exportPDF but multipage does not work.  (I am using @Html.RadioButtonFor control in the project)
Issue2:  The content inside the MVC controls like TextBoxFor and EditorFor seems to not show up correctly in PDF.  The content moves up in the box and hence not visible in the pdf.  The below image has an example of this issue:

 

Here is the code for reference:

 

@{
    ViewBag.Title = "Export";
}

<h2>Export</h2>

<input type="button" value="Export PDF without pagebreak" id="ExportButton1" class="btn btn-default pull-right" /><br/>
<input type="button" value="Export PDF with pagebreak" id="ExportButton2" class="btn btn-default pull-left" />

<div class="form-horizontal margin-top-20" style="margin-top:70px;">
    <div class="pdf-page size-a4">

        Name:@Html.TextBox("Name", null, new { @class = "form-control" })<br />
        Desc:@Html.TextArea("Description", null, new { @class = "form-control" })<br />
        @for (int i = 0; i < 100; i++)
        {
            <text> Radio  @i</text>
            @Html.RadioButton("Radio", i, new { @class = "form-control" })<br />
        }
</div>
</div>


@section scripts {
<script type="text/javascript">
    $(document).ready(function () {
        $(document).on("click", "#ExportButton1", function () {
            kendo.drawing.drawDOM($(".pdf-page"))
            .then(function (group) {
                // Render the result as a PDF file
                return kendo.drawing.exportPDF(group, {
                    paperSize: "auto",
                    margin: { left: "1cm", top: "1cm", right: "1cm", bottom: "1cm" }
                });
            })
        .done(function (data) {
            // Save the PDF file
            kendo.saveAs({
                dataURI: data,
                fileName: "Test.pdf",
            });
        })
        });
    });


    $(document).ready(function () {
        $(document).on("click", "#ExportButton2", function () {
            kendo.drawing.drawDOM($(".pdf-page"),{
                paperSize: "A4",
                margin: { left: "1cm", top: "1cm", right: "1cm", bottom: "1cm" }
            })
            .then(function (group) {
                // Render the result as a PDF file
                return kendo.drawing.exportPDF(group);
            })
        .done(function (data) {
            // Save the PDF file
            kendo.saveAs({
                dataURI: data,
                fileName: "Test.pdf",
            });
        })
        });
    });

    </script>
}

T. Tsonev
Telerik team
 answered on 12 Feb 2016
2 answers
191 views

The grid is setup and works perfectly and has detail rows associated.  A button is to live on the detail section and do the same thing as the little triangle that collapses the row.  Looking through the forums, I see the following code should work, but it doesn't close the record.  Any help will be greatly appreciated.

 

<script>
    var toggleDetail = function(e) {
         var grid = $("#childGrid").data("kendoGrid");
        var parentRow = grid.wrapper.closest("tr").prev();
        grid.collapseGroup(parentRow);
 
    };
 
    $(document).ready(function () {
          $(document).on("click", "#toggleDetail", toggleDetail);
    });
 
</script>


@(Html.Kendo().Grid<Elsis.Application.Model.Child.ChildListModel>()
        .Name("childGrid")
        .Columns(columns =>
        {
            columns.Bound(c => c.Name).Width(120);
            columns.Bound(c => c.Age).Width(80);
            columns.Bound(c => c.Teachers).Width(200);
            columns.Bound(c => c.Schedule).Width(200);
        })
        .HtmlAttributes(new { style = "height: 550px;", @class = "lcesGrid" })
        .Scrollable()
        .Sortable()
        .ClientDetailTemplateId("childDetailTemplate")
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .DataSource(dataSource => dataSource
            .Ajax()
                .Read(read => read.Action("ChildList_Read", "ChildList"))
            .PageSize(20)
        )
)

<script id="childDetailTemplate" type="text/kendo-tmpl">
    <div>
        <div style="float: left; width:100px;">
            <div>Picture</div>
            <div>Full Bio</div>
        </div>
        <div style="float: left;width: 800px;">
            <div style="float: left;width: 800px;">
                <div style="float: left;width: 225px;">
                    <span id="name">#= Name #</span>
                    <span id="childId">(#= ChildId #)</span>
                </div>
                <div style="float: left; width: 100px;">
                    <span id="age">#= Age #</span>
                </div>
                <div style="float: left; width: 100px;">
                    <button id="toggleDetail" class="toggleDetail">Close Button</button>
                </div>
            </div>
        </div>

    </div>

</script> 

 

 

Chris
Top achievements
Rank 1
 answered on 11 Feb 2016
4 answers
368 views

I have a more detailed look at what I'm trying to do here (http://stackoverflow.com/questions/35158369/how-do-you-customize-kendoui-grid-column-menu-for-mobile), this is the only thing stopping me right now from using the GRID.

 After looking around for desktop mode I found how to modify the column menus.

 columnMenuInit: function (e) { console.log("menu init");var field = e.field; console.log(field);var menu = e.container.find(".k-menu").data("kendoMenu"); menu.append([{text: "Highlight", spriteCssClass: "k-i-custom", content: '<div class="colorpicker' + field + '"></div>'}]); $(".colorpicker" + field).kendoFlatColorPicker({ preview: false, value: "#000", change: select});};

 

However, this does not work for mobile when mobile:true is set for the grid (A.K.A adaptive rendering mode).  How would I customize the menu for the mobile version?

Joseph
Top achievements
Rank 2
 answered on 11 Feb 2016
1 answer
194 views

I am working a set of data that contains arrays as IDs. I need some help working around this as it appears unsupported and breaks some things.

Example item from the first set of data:

{
  "id":[1,2,3,4],
  "name":"Another VIP-VID-INPUT-1",
  "internal":true
}

This data is referenced from second set of data which uses the same array IDs to refer to the first set. Example item from the second set of data:

{
  "id":2,
  "name":"Link 02",
  "head_port_id":[1,2,3,4],
  "tail_port_id":[2,2,3,4],
  "disabled":false
}

For starters I am populating a Grid with the second set of data. I use a column.template to replace "head_port_id" and "tail_port_id" with the relevant "name" field from the first set of data. This works fine.

The problem arises when I try to use a DropDownMenu inside column.editor for the "head_port_id" and "tail_port_id" columns. Clicking the cell causes an error. 

editor: function(container, options) {
    var editor = $('<input />')
        .attr('name', options.field) // "head_port_id"
        .attr('required', 'required')
        .attr('data-bind', 'value:' + options.field); // "head_port_id"
     
    container.append(editor);
     
    editor.kendoDropDownList({
        autoBind: false,
        dataSource: data.ports.datasource, // the first set of data
        dataTextField: 'name',
        dataValueField: 'id'
    });
}
  The error I get looks like this:

Uncaught TypeError: o[s].get is not a function
E.widget.value.v.extend.refresh @ kendo.all.js:8886
I.extend.bind @ kendo.all.js:8153
w.extend.applyBinding @ kendo.all.js:9146
I.extend.bind @ kendo.all.js:9096
a @ kendo.all.js:9239
a @ kendo.all.js:9247
a @ kendo.all.js:9247
s @ kendo.all.js:9262
c.extend.refresh @ kendo.all.js:36822
c.extend.init @ kendo.all.js:36731
(anonymous function) @ kendo.all.js:2382
b.extend.each @ jquery-1.9.1.min.js:3
b.fn.b.each @ jquery-1.9.1.min.js:3
e.fn.(anonymous function) @ kendo.all.js:2381
ue.ui.DataBoundWidget.extend.editCell @ kendo.all.js:45210
(anonymous function) @ kendo.all.js:45168
b.event.dispatch @ jquery-1.9.1.min.js:3
v.handle @ jquery-1.9.1.min.js:3

Since I have the minified code it's difficult to debug this, even though I can see the full source code (a source map is loaded I assume). Breakpoints and scope vars aren't cooperating.

Anyway I had an idea which was to define a "parse" function for all of the array ID fields, in my Models. It simply converted the ID arrays .toString(). This works pretty well except that it has a fatal flaw in which the data I send to the relevant service is now invalid, since the service is expecting arrays and not strings.

How can I convert these IDs back to arrays, ideally without doing this in the DataSource transport functions (update, create, etc)? I have a generic DataSource wrapper that I am using to wrap our own CRUD interface.. I don't want it to have special cases in it for this once type of data.

T. Tsonev
Telerik team
 answered on 11 Feb 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
ScrollView
Switch
TextArea
BulletChart
Licensing
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?