Telerik Forums
Kendo UI for jQuery Forum
1 answer
110 views
I have a controller that returns an HttpResponseMessage.

public HttpResponseMessage Get()
{
    return GetByEnteredDate(Convert.ToDateTime("10/16/2013"));
}
 
public HttpResponseMessage GetByEnteredDate(DateTime enteredDate)
{
    return GetByEnteredDates(enteredDate.Date, enteredDate.Date.Add(new TimeSpan(23, 59, 0)));
}
 
public HttpResponseMessage GetByEnteredDates(DateTime fromDate, DateTime thruDate)
{
    var licenses =
        (from li in repository.All
         where !li.Deleted
         && li.DateEntered >= fromDate
         && li.DateEntered <= thruDate
         select li).ToList();
 
    if(licenses != null && licenses.Any())
    {
        return Request.CreateResponse<IEnumerable<LicenseDto>>(HttpStatusCode.OK,
            mapper.Map<IEnumerable<Hialeah.License.Domain.License>, IEnumerable<LicenseDto>>(licenses));
    }
 
    throw new HttpResponseException(HttpStatusCode.NotFound);
}

I then create a simple page and try to load a grid. For the life of me, I have not been able to make it work. I know the service returns data. But I can't even see the call in Google chrome. It just shows the grid with no data. I have tried many combinations in the schema. I place a break point on the Get() method and it doesn't get there. :-(

<div id="licensesGrid"></div>
 
<script type="text/javascript">
 
    $(document).ready(function () {
 
        var licenseDataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "api/licenses",
                    datatype: "json"
                }
            },
            schema: {
                data: function (response) {
                    return response.Data;
                }
            },
            pageSize: 10
        });
 
        $("#licensesGrid").kendoGrid({
            datasource: licenseDataSource,
            pageable: true,
            sortable: true
        });
 
    });
 
 
</script>

Thank you so much,
Carlos
Petur Subev
Telerik team
 answered on 24 Apr 2014
1 answer
580 views
Hi there,

I created a data bound date picker using the data-role attribute as follows: 

         <input id="startDatepicker" name="startDatepicker" class="datePicker" data-role="datepicker" data-bind="value: settings.startDate" data-format="yyyy-MM-dd" />

when I try to change the data-format to 'dd-MM-yyyy' the value wont show up, I think its because the default culture is en-US and therefore the date value becomes invalid. is there a way to specify the culture of the control to say en-NZ so that I can specify the format to dd/MM/yyyy correctly?

There are quite a few examples with setting date format as follows:

$("#datepicker").kendoDatePicker({
culture: "de-DE"
});

but does say how to do data binding if I am doing it this way

Any suggestions around either approach is greatly appreciated. 

Thanks
Paul 
Georgi Krustev
Telerik team
 answered on 24 Apr 2014
1 answer
614 views
Hi,

I have a grid with date column. If the date value is greater than 30 then i want to display the date value as is otherwise display the difference in days like "In x Days".

I able to display formatted date value or difference in days correctly using the below code.

div class="col-md-12" id="recurringPaymentList">
@(Html.Kendo().Grid<PaymentsModel>()
.Name("scheduledPayment")
.Columns(columns =>
{
columns.Bound(c => c.NextPaymentDate).ClientTemplate(
"#= ( Math.round((NextPaymentDate - new Date())/1000/60/60/24 ))>30 ? kendo.toString(NextPaymentDate, 'MM/dd/yyyy') : kendo.toString(Math.round((NextPaymentDate - new Date())/1000/60/60/24 )) #"
);

However, when i try to contenate string values (see code below) in the ternary expression grid data does not bind and i dont see any error.

columns.Bound(c => c.NextPaymentDate).ClientTemplate(
"#= ( Math.round((NextPaymentDate - new Date())/1000/60/60/24 ))>30 ? kendo.toString(NextPaymentDate, 'MM/dd/yyyy') : 'In ' + kendo.toString(Math.round((NextPaymentDate - new Date())/1000/60/60/24 ))  " ' Day' #"
);

Is there any way to get the string contenate work in ternary expression or any other way of doing this?
 

Dimiter Madjarov
Telerik team
 answered on 24 Apr 2014
1 answer
190 views
When I remove and then add a row in the Kendo grid, it increments the value by 1 instead of showing the same number of rows.

For eg, if I have only one row,

var dataSource1 = $("#grid").data("kendoGrid").dataSource;
a =dataSource1.data()[0];
dataSource1.remove(a)
alert("Total after removing a row : " + dataSource1.total()) // Now this is 0
dataSource1.add("Total after adding the same row" + a)
alert(dataSource1.total()) // Now this gives 2?!?!?!

But looking into the grid.dataSource.data().length gives the correct value of 1.
Due to this, the number of records present in the table shown in the table footer is displayed incorrectly.() It is shown as (1 - 2 of 2 records, instead of 1-1 of 1 record)

This also works for removing and adding multiple rows.
Rosen
Telerik team
 answered on 24 Apr 2014
1 answer
115 views
Hi,
is it possible to use the recurrence control without the scheduler?
is yes, is there an example I can look at?
Thanks,
Mickey
Vladimir Iliev
Telerik team
 answered on 24 Apr 2014
1 answer
216 views
I notice in the Sortable demos you guys show how to move an item in a DataSource instance on the change event.  How would I go about properly doing this if I am using an ObservableArray instead?
Alexander Valchev
Telerik team
 answered on 24 Apr 2014
1 answer
130 views
Hello,

For test purposes, I'm trying to resize a line chart that is embedded in a RadPane as soon as the size of the browser window changes. This is done by calling kendo.resize. The following code defines my sample web form:

<%@ Page Language="VB" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="RadControlsWebApp1._Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server" style="width: 100%; height: 100%;">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
 
    <style type="text/css">html { height: 95%; overflow: visible; }</style>
 
    <link href="styles/kendo.common.min.css" rel="stylesheet" />
    <link href="styles/kendo.default.min.css" rel="stylesheet" />
    <link href="styles/kendo.dataviz.min.css" rel="stylesheet" />
    <link href="styles/kendo.dataviz.default.min.css" rel="stylesheet" /> 
</head>
<body style="height: 100%;">
    <form id="form1" runat="server" style="height: 100%;">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
 
            <asp:ScriptReference Path="~/js/jquery.min.js" />
            <asp:ScriptReference Path="~/js/kendo.all.min.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        function createChart() {
            $("#chart").kendoChart({
                title: {
                    text: "A Report"
                },
                legend: {
                    position: "bottom"
                },
 
                series: [{
                    type: "area",
                    data: [2, -1, 3],
                    name: "Signal 1",
                    color: "#ff1c1c",
                    axis: "ax_1"
                }, {
                    type: "area",
                    data: [3, 5, 30],
                    name: "Signal 2",
                    color: "#ffae00",
                    axis: "ax_2"
                }],
 
                valueAxes: [{
                    name: "ax_2",
                    min: 0,
                    max: 40,
                    axisCrossingValue: 0
                }, {
                    name: "ax_1",
                    min: -2,
                    max: 5
                }],
 
                categoryAxis: {
                    categories: ["2013", "2014", "2015"],
                    axisCrossingValues: [4, 0],
                    justified: true
                },
 
                tooltip: {
                    visible: true,
                    format: "{0}",
                    template: "#= category #/03: #= value #"
                }
            });
        }
 
        $(document).ready(createChart);
        $(document).bind("kendo:skinChange", createChart);
        $(window).on("resize", function () {
            kendo.resize($("#chart"));
        });
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
         
    <telerik:RadSplitter ID="rsProTrendFrame" Runat="server" Width="100%" Height="100%">
        <telerik:RadPane ID="rpApplication" Runat="server" Width="100%" Height="100%">
            <div id="example" class="k-content" style="width: 100%; height: 100%;">
                <div class="chart-wrapper" style="width: 100%; height: 100%;">
                    <div id="chart" style="width: 100%; height: 100%;">
                    </div>
                </div>
            </div>
        </telerik:RadPane>
    </telerik:RadSplitter>
    </form>
</body>
</html>

Unfortunately, the line chart is not being resized correctly. How can I avoid this problem?
Vessy
Telerik team
 answered on 24 Apr 2014
1 answer
208 views
Hi,

I am working on a dataGrid, which needs to be editable, and able to export CSV file.


so the columns  this:

columns: [{command: ["edit"], title: " ", width: "100px"},
{field:"channelId", title: dict.channel,template:'#: channelList[(channelId-1)]#'},
{field:"campaignId", title:dict.campaign,editor: disabledEditor},
{field:"status", title:dict.status,template:'<span style="text-transform:lowercase">#: status#</span>'},
{field:"budget", title:dict.budget+' (USD)', type: "number",format: "{0:c2}"},

{field:"impressior", title:dict.impressior,type: "number"},
{field: "clcik", title:dict.click,type: "number"},
{field: "dailyBudget", title:dict.cost,type: "number",format: "{0:c}"},
{field: "conv", title:dict.conv,type: "number"},
{field: "avgPost", title:dict.avgPost,type: "number"},
{field: "ctr", title:dict.ctr,type: "number"},
{field: "cpc", title:dict.cpc,type: "number"},
{field: "cpa", title:dict.cpa,type: "number"}
],

I am using this method to export csv:
http://blog.falafel.com/Blogs/RachelHagerman/rachel-hagerman/2014/02/04/super-simple-spreadsheet-export-from-kendo-ui-grid

however, as I used 'template' in 'columns', the export CSV function crashed here:


if (value && template && exportFormat !== false) {
value = _.isFunction(template)
? template(data[row])
: kendo.template(template)(data[row]);
}

if I takes out 'template' from 'columns' and use 'rowTemplate' like this:
rowTemplate: '<tr data-uid="#= uid #"><td></td><td>#= channelList[(channelId-1)]#</td><td>#: campaignId#</td><td style="text-transform:lowercase">#: status#</td><td>#: budget#</td><td>#: impressior#</td><td>#: clcik#</td><td>#: dailyBudget#</td><td>#: conv#</td><td>#: avgPost#</td><td>#: ctr#</td><td>#: cpc#</td><td>#: cpa#</td></tr>',

 the CSV export script works, but the edit button do not appear

I tried to put '<a class="k-button k-button-icontext k-grid-edit" href="#"><span class="k-icon k-edit"></span>Edit</a>' in the row template like this example
but still not working



Another problem is, the value of one of the field is number, but what needs to be display are string, refer to an Array, like this:

 '#: channelList[(channelId-1)]#'

It only returns the number on the CSV


please help and  thanks






 
Vladimir Iliev
Telerik team
 answered on 24 Apr 2014
2 answers
118 views
Thanks for your response. And if so, can you please let me know how it should be done? 

Regards,

UK
Sebastian
Telerik team
 answered on 24 Apr 2014
1 answer
763 views
Please tell me how can we remove element from multi listview. When i am selecting any item it is giving me value but i am unable to remove selected elements.

PSB code:

var data = [
    { id: 1, text: "text 1" },
    { id: 2, text: "text 2" },
    { id: 3, text: "text 3" }
];


var d = $("#listview").kendoListView({
    dataSource: data,
    template: kendo.template($("#template").html()),
    selectable: "multiple",
    change: function() {
        var index = this.select().index(),
            dataItem = this.dataSource.view()[index];
  
        //log("id: " + dataItem.id + ", text: " + dataItem.text);
        var selected = $.map(this.select(), function(item) {
            return data[$(item).index()].id;
               });
        //data.remove(selected);
        //console.log(data);
        console.log(selected);
        //console.log("[" + selected.join(", ") + "]");
    }
});


Please see jsfiddle : http://jsfiddle.net/AAMLA/179/
Alexander Popov
Telerik team
 answered on 24 Apr 2014
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
Marco
Top achievements
Rank 4
Iron
Iron
Iron
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
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
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
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?