Telerik Forums
Kendo UI for jQuery Forum
3 answers
485 views

I'm trying to add a custom drop event to each tree view node so that I can handle the 'drop' event when a file is dropped onto the node element from Windows File Explorer.  My html code (with the style section removed) looks like this:

 

<div id="example">
        <div class="demo-section k-header">
            <div class="box-col" style="width: 300px">
                <h4>Select a node</h4>
                <div class="files"
                     data-role="treeview"
                     data-drag-and-drop="false"
                     data-text-field="name"
                     data-spritecssclass-field="type"
                     data-bind="visible: isVisible,
                            source: files,
                            events: { dataBound: onDataBound }"></div>
            </div>
        </div>
        
        <script>
            $(document).ready(function ()
            {
                $("#treeview").kendoTreeView();
            });
        </script>
    </div>

 

I'm binding the view model like this:

<script>
    var viewModel = kendo.observable({
        isVisible: true,
        onDataBound: function (e)
        {
            if (e.node)
            {
                var dataItem = e.sender.dataItem(e.node);
 
                dataItem.bind('drop', function (e1)
                {
                    alert('dropped on item');
                });
            }
        },
        files: kendo.observableHierarchy(jobBookAPI.directoryContents)
    });
    kendo.bind($("#example"), viewModel);
 
</script>

My data looks like this:

var jobBookAPI = new function ()
{
    // Public data
 
    this.directoryContents =
        [
            {
                name: "My Web Site", type: "folder", expanded: true, items:
                [
                    {
                        name: "images", type: "folder", expanded: true, items:
                        [
                            { name: "logo.png", type: "image" },
                            { name: "my-photo.jpg", type: "image", id: 12345 }
                        ]
                    },
                    {
                        name: "resources", type: "folder", expanded: true, items:
                        [
                            { name: "resources", type: "folder" },
                            { name: "zip", type: "folder" }
                        ]
                    },
                    { name: "about.html", type: "html" },
                    { name: "index.html", type: "html" }
                ]
            }
        ];
 
};
 

 

The drop event does not fire when I drag a file onto a node.  I've tried replacing 'drop' with 'click' just to see if I can fire a click event, but that event doesn't fire when a node is clicked.  I think that what I'm trying to do should be possible because I've use this same method with simple DIV elements and files dropped on them from File Explorer cause the drop event to fire perfectly.

Any ideas what I'm doing wrong?

Thanks. 

 

 

T. Tsonev
Telerik team
 answered on 19 Jun 2015
1 answer
120 views
That would be very handy. Are there any plans to implement that in the near future?
Kiril Nikolov
Telerik team
 answered on 18 Jun 2015
3 answers
297 views

I am using a grid with an odata datasource.

 When I enable serverSorting and serverFiltering it isn't working. For some reason the endpoint (Azure Mobile Service .net Backend) returns a bad request when the $'s are encoded.

For example, here is a request with the $ encoded:

GET /tables/members?%24inlinecount=allpages&%24top=50&%24orderby=memberNumber

For some reason, that returns bad requst: message=The query specified in the URI is not valid. Could not find a property named 'memberNumber' on type 'myapi.DataObjects.Members'.

But, if I take the same request from fillder into the composer and change it to:

GET /tables/members?%24inlinecount=allpages&%24top=50&$orderby=memberNumber 

I get a 200 response and the grid binds to the data no problem.

I tried to set processData to false, but that just sends like [object:object] on the Url.

Any idea how I can prevent the $'s from being encoded? Or, how I can turn them back to $, perhaps in the beforeRequest method?

 

 

 

Bob
Top achievements
Rank 1
 answered on 18 Jun 2015
4 answers
592 views

I have a treeView with checkable nodes and a couple of buttons with which I can "check all" and "check none".

These buttons run through dataSource.data() and and call set('checked', true) or set('checked', false) on each node.

 This all works well until I start filtering the dataSource by its 'checked' state:

dataSource.filter({ field: 'checked', operator: 'eq', value: true });

When the filter is on (means I want to only see the checked items), and I click on "check none", I would like all the items in the treeview to dissapear (which is what the datasource tells me when I look at dataSource.view(): it contains 0 items). When I click on "check all", I would like all the items in the treeview to appear. Also, when I uncheck an individual item, I would like it to dissapear immediately.

I can accomplish that with re-setting the filter, but the problem is that this takes ages. With a treeview of 1300 items (and this is without any children loaded), resetting the filter takes almost 10 seconds!

Is there a better - or rather usable - way to refresh the treeview's filter after a node has been checked/unchecked?

Alexander Popov
Telerik team
 answered on 18 Jun 2015
13 answers
709 views
Hello,

How can I localize the Scheduler?

Thanks,
Koen
Vladimir Iliev
Telerik team
 answered on 18 Jun 2015
2 answers
465 views

Hi,

 After a lot of searching I found out how to get group-level and grand-total aggregates working.  

 However, now that is in place, I find that changing the grouping via the GUI blows up.  

I guess this makes sense since the aggregation is set as a static object, but this must be a common requirement surely?  I want to have group level aggregates and the grand total continue to work even if the user wants different grouping.

 I've created a JSFiddle to focus any help people can offer.

I suspect this may involve my catching a grid event but I welcome any suggestion.  I can reference an object as the datasource group attribute.

var grouping = {
    field: "deal.dealStatus",
    aggregates: [{
        field: "valueUSD",
        aggregate: "sum"
    }]
};
 
 
 
    dealDataSource = new kendo.data.DataSource({
        ...
        aggregate: [
            { field: "valueUSD", aggregate: "sum" }
        ],
        //group: function () {
        //    return {
        //        field: "deal.dealStatus",
        //        aggregates: [{
        //            field: "valueUSD",
        //            aggregate: "sum"
        //        }]
        //    };
        //},
        group:grouping,

Is this the way to go?  To dynamically change "grouping" based on grouping changes?

 

 Thanks

Chris

 

Rosen
Telerik team
 answered on 18 Jun 2015
1 answer
123 views

Hi Support,

 

Is there any pinchin and pinchout gesture in KendoUI?

If yes, where can I find the documentation on this?

If no, how do I simulate this gesture?

I really appreciate if you response to this as quick as possible. 

Many thanks in advance.

Petyo
Telerik team
 answered on 18 Jun 2015
1 answer
137 views

I am trying to make the category field of a template, that when in edit mode turns into a dropdown box that lists all the available categories. Is there a simple way to do this?

 I would like to keep the dropdown hidden until the field is actually edited.

 

This is my current template: 

<script id="rowTemplate" type="text/x-kendo-template">
        <tr class="k-master-row" data-uid=#: uid #> 
            <td class="k-hierarchy-cell">
                <a href="\\#" class="k-icon k-plus" title="transaction details"></a>
            </td>
            <td>#= kendo.toString(transactionDate, 'MM/dd/yyyy') #</td>
            <td>#: description.description #</td>
            <td>#: category.categoryName #</td>
           <td>#: account.accountName #</td>
            <td class="currencyField">#=kendo.toString(amount.amount, 'c') #</td>
            <td class="tId">#: transactionBaseType #</td>
            <td>
              <a class="k-button k-button-icontext k-grid-edit" href="\#">
                <span class="k-icon k-edit"></span>Edit
              </a>
            </td>
        </tr>
    </script>

Daniel
Telerik team
 answered on 18 Jun 2015
1 answer
425 views

Hello, 

In some demos & examples I found this : "stringifyDates": true  in the data source configuration, 
but didn't find anything in the documentation about this. (looks like a secret settings option Telerik uses on their demos  ;-) 

is somebody has a documentation about this "stringifyDates": true ?

another thing on same subject,  I try to use the parameterMap , to parse the model sent to the server,

and stringify the date in the model "SupplyDate": { "type": "date" }, but  its never called! 

please see example here.

var ds = new kendo.data.DataSource({
    "type": (function () { if (kendo.data.transports['aspnetmvc-ajax']) { return 'aspnetmvc-ajax'; } else { throw new Error('The kendo.aspnetmvc.min.js script is not included.'); } })(),
    "transport": {
        "read": {
            "url": '/Controller/Products_Get',
            "data": function () {
                return {
                    "OrderNumber": "0001"
                };
            },
            "complete": function (jqXHR, textStatus) {
                if (textStatus == "error") {
                    var msg = "read event completed with error. invalid url or other javascript error";
                    console.log(msg);
                } else {
                    var result = JSON.parse(jqXHR.responseText);
                    console.log("jqXHR.responseText:\n" + jqXHR.responseText, '#ffffff', '#0011cc');
                }
            }
        },
        "update": {
            "//type": "POST",
            //"dataType": "json",
            //"contentType": "application/json",
            "url": '/Controller/Product_Upsert',
            "complete": function (jqXHR, textStatus) {
                Parse_UpsertOrDelete_Complete("update", jqXHR, textStatus);
            }
        },
        "create": {
            //"type": "POST",              
            //"dataType": "json",
            //"contentType": "application/json",
            "url": '/Controller/Product_Upsert',
            "complete": function (jqXHR, textStatus) {
                Parse_UpsertOrDelete_Complete("create", jqXHR, textStatus);
            }
        },
        "destroy": {
            //"type": "POST",               
            //"dataType": "json",
            //"contentType": "application/json",
            "url": '/Controller/Product_Delete',
            "complete": function (jqXHR, textStatus) {
                Parse_UpsertOrDelete_Complete("destroy", jqXHR, textStatus);
            }
        },
        "stringifyDates": true,
        "prefix": "",
        "parameterMap": function (data, operation) {
 
            console.log("operation: " + operation + " data: " + JSON.stringify(data));
 
            if (operation === "update" || operation === "create" || operation === "destroy") {
                return JSON.stringify({ entity: data });                   
            }
            return data;
        }
    },
    "pageSize": 1000,
    "page": 1,
    "total": 0,
    "serverPaging": true,
    "serverSorting": true,
    "serverFiltering": true,
    "serverGrouping": true,
    "serverAggregates": true,
    "filter": [],
    "error": function (jqXHR) {
        console.log("jqXHR.status =" + jqXHR.status);
    },
    "schema": {
        "data": "Data",
        "total": "Total",
        "errors": "Errors",
        "model": {
            "id": "ProductionOrderNumber",
            "fields": {                                       
                "OrderNumber": { "type": "number" },
                "SupplyDate": { "type": "date" },                   
                "CustomerName": { "type": "string" },                   
                "Units": { "type": "number" }
            }
        }
    }
});

 

 

function Parse_UpsertOrDelete_Complete(action, jqXHR, textStatus) {

 // handle complete...

}

 

 

Controller

class ProductEntity {
    public int OrderNumber {get;set;}
    public DateTime SupplyDate {get;set;}                   
    public string CustomerName {get;set;}                 
    public int Units {get;set;}
}
 
[AcceptVerbs(HttpVerbs.Post)]
public async Task<ActionResult> Product_Upsert([DataSourceRequest]DataSourceRequest request,
                   ProductEntity entity)
{
 
        ProductEntity product =  entity;
 
        // product.SupplyDate  not set correctly when not using
        //  (   "stringifyDates": true  in the DataSource )
 
          
}


Thanks ! 

 

 


Daniel
Telerik team
 answered on 18 Jun 2015
3 answers
1.4K+ views

Hi There,

 

I have a grid which has a row template. I am facing a problem in making the rows inline editable.

Reason why I need to use the row template ( as I dont know whether this can be achieved without a row template)

I have total 8 fields in my datasource, but 

I need to show first two fields in First Column one below another, next two fields in second column just like in the first column and next two in 3 and so on so forth. See the following format

 

Action                                           ACCT                                    TEMPLATE                     

A1                    OPT1                   A: Acct1                                 SomeTemplate                               EDITBUTTON

B1                    OPT2                   B: Acct2 

 

This is how the data would be displayed in one row. 

In edit mode, I need to allow the user to edit the OPT(column without header) ACCT and TEMPLATE columns.

All these editable columns will display a Dropdownlist from which the user can select a value.

 

Can anyone help ?

 

Thank You,

Nilesh

Petyo
Telerik team
 answered on 18 Jun 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?