Telerik Forums
Kendo UI for jQuery Forum
6 answers
199 views
When using widget initialization with "data-attributes", can you set min/max date/time for the date/time pickers?

I've tried using "data-min" for both the date and time pickers, but Kendo doesn't like it.

http://jsfiddle.net/q3FPV/3/

Thanks.
Todd
Top achievements
Rank 1
 answered on 14 Sep 2012
0 answers
114 views
Hi,

We are totally lost here. We've been able to create a page that has a grid and uses a remote datasource with inline editing without problems. Now we discovered the 'batch editing' fascility of the grid and would like to use that.

We have however no clue how to receive the updated, created and deleted rows from the view and process them to the DB. We've been searching the web, documentation and examples for many hours now and are just plain stuck.

Who can help us?

Regards
Paul Sinnema

Here's the manually coded view that we use:
<script src="@Url.Content("~/DataSources/ProjectOnderhoudDataSource.generated.js")" type="text/javascript"></script>
<div id="projectEditForm">
<input id="DatumAanvang" data-bind="value: selectedProject.DatumAanvang" />
<hr />
<div id="projectRegelGrid" class="k-content"/>
<script type="text/javascript">
$(function ()
{
$("#DatumAanvang").width(220).kendoDatePicker();
ProjectOnderhoudDataSource.bind("change", function (data)
{
ProjectOnderhoudViewModel.set("selectedProject", this.view()[0]); // not nice yet
});
ProjectOnderhoudDataSource.read();
kendo.bind($("#projectEditForm"), ProjectOnderhoudViewModel);
ProjectOnderhoudProjectRegelListDataSource.options.transport.read.parentId = 1;
$("#projectRegelGrid").kendoGrid
({
dataSource: ProjectOnderhoudProjectRegelListDataSource,
navigatable: true,
// deletable: true,
pageable: true,
// sortable: true,
height: 400,
toolbar: ["create", "save", "cancel"],
columns:
[
{ field: "Aantal", title: "Aantal" },
{ field: "Prijs", title: "Prijs", format: "{0:c}" },
{ field: "BTW", title: "BTW", format: "{0:c}" },
{ field: "CreatedOn", title: "Datum aangemaakt", template: '#= kendo.toString(CreatedOn, "dd MMMM yyyy") #' },
{ field: "ChangedOn", title: "Datum gewijzigd", format: "{0:dd MM yyyy}" },
{ command: ["destroy"], title: " ", width: "110px" }
],
editable: true
});
});
</script>
</div>

And the DataSource we generate:
var ProjectOnderhoudDataSource = new kendo.data.DataSource
({
transport:
{
read:
{
url: "../ProjectOnderhoud/Get"
},
update:
{
url: function(item)
{
return "../ProjectOnderhoud/Update/" + item.Id;
},
type: "POST"
},
destroy:
{
url: function(item)
{
return "../ProjectOnderhoud/Delete/" + item.Id;
},
type: "DELETE"
},
create:
{
url: "../ProjectOnderhoud/Create",
type: "POST"
},
parameterMap: function (data, operation)
{
if(operation === "update")
{
var date;
date = new Date(data.DatumAanvang);
data.DatumAanvang = kendo.toString(new Date(data.DatumAanvang), "dd-MM-yyyy HH:mm:ss");
date = new Date(data.DatumFaktuur);
data.DatumFaktuur = kendo.toString(new Date(data.DatumFaktuur), "dd-MM-yyyy HH:mm:ss");
date = new Date(data.CreatedOn);
data.CreatedOn = kendo.toString(new Date(data.CreatedOn), "dd-MM-yyyy HH:mm:ss");
date = new Date(data.ChangedOn);
data.ChangedOn = kendo.toString(new Date(data.ChangedOn), "dd-MM-yyyy HH:mm:ss");
}
return data;
}
},
schema:
{
model:
{
id: "Id",
fields:
{
DatumAanvang:
{
type: "date",
validation: { required : true }
},
DatumFaktuur:
{
type: "date",
validation: { required : true }
},
Name:
{
type: "string",
validation: { required : true }
},
Id:
{
type: "int",
validation: { required : true }
},
CreatedOn:
{
type: "date",
validation: { required : true }
},
CreatedBy:
{
type: "int",
validation: { required : true }
},
ChangedOn:
{
type: "date",
validation: { required : true }
},
ChangedBy:
{
type: "int",
validation: { required : true }
}
}
}
}
});
var ProjectOnderhoudViewModel = new kendo.observable
({
projectSource: ProjectOnderhoudDataSource,
selectedProjectOnderhoud: null
});
var ProjectOnderhoudProjectRegelListDataSource = new kendo.data.DataSource
({
transport:
{
read:
{
url: function()
{
var parentId = ProjectOnderhoudProjectRegelListDataSource.options.transport.read.parentId;
return "../ProjectOnderhoud/GetProjectRegelList/" + parentId;
},
parentId: null
},
update:
{
url: function(item)
{
if(item != null && item.Id != undefined)
{
return "../ProjectRegel/Update/" + item.Id;
}
return "../ProjectRegel/Update/-1";
},
type: "POST"
},
destroy:
{
url: function(item)
{
return "../ProjectRegel/Delete/" + item.Id;
},
type: "DELETE"
},
create:
{
url: "../ProjectRegel/Create",
type: "POST"
},
parameterMap: function (data, operation)
{
if(operation === "update")
{
var date;
date = new Date(data.CreatedOn);
data.CreatedOn = kendo.toString(new Date(data.CreatedOn), "dd-MM-yyyy HH:mm:ss");
date = new Date(data.ChangedOn);
data.ChangedOn = kendo.toString(new Date(data.ChangedOn), "dd-MM-yyyy HH:mm:ss");
}
return data;
}
},
batch: true,
pageSize: 15,
schema:
{
model:
{
id: "Id",
fields:
{
Aantal:
{
type: "int",
validation: { required : true },
editable: true
},
Prijs:
{
type: "float",
validation: { required : true },
editable: true
},
BTW:
{
type: "float",
validation: { required : true },
editable: true
},
Id:
{
type: "int",
validation: { required : true },
editable: true
},
CreatedOn:
{
type: "date",
validation: { required : true },
editable: true
},
CreatedBy:
{
type: "int",
validation: { required : true },
editable: true
},
ChangedOn:
{
type: "date",
validation: { required : true },
editable: true
},
ChangedBy:
{
type: "int",
validation: { required : true },
editable: true
}
}
}
}
});

And finally the controller we generate:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net.Http.Formatting;
using System.Net.Http;
using MVC3DOViewmodel;
using System.Web;
using System.Web.Mvc;
using Xtensive.Orm;
using Xtensive.Orm.Web;
using System.Net;
 
namespace MVC3DOApp.Controllers
{
    public partial class ProjectOnderhoudController : MainController
    {
        public ActionResult Index()
        {
            return this.View();
        }
 
        public object Get() // List<PCProjectOnderhoud>
        {
            if(HasId)
            {
                return Json(VMProjectOnderhoud.GetById(this, Id), JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json(VMProjectOnderhoud.AllVMProjectOnderhoudList(this), JsonRequestBehavior.AllowGet);
            }
        }
 
        public HttpResponseMessage Update(int id)
        {
            HttpResponseMessage response = new HttpResponseMessage();
 
            if (id == -1) // Batch update
            {
                response.StatusCode = HttpStatusCode.OK;
            }
            else
            {
                using (var entity = VMProjectOnderhoud.GetById(this, Id))
                {
                    entity.DatumAanvang = Convert.ToDateTime(Request["DatumAanvang"]);
                    entity.DatumFaktuur = Convert.ToDateTime(Request["DatumFaktuur"]);
                    entity.Name = Request["Name"];
                    entity.CreatedOn = Convert.ToDateTime(Request["CreatedOn"]);
                    entity.CreatedBy = Convert.ToInt32(Request["CreatedBy"]);
                    entity.ChangedOn = Convert.ToDateTime(Request["ChangedOn"]);
                    entity.ChangedBy = Convert.ToInt32(Request["ChangedBy"]);
 
                    SaveChanges();
 
                    response.StatusCode = HttpStatusCode.OK;
                }
            }
 
            return response;
        }
 
        public object Delete(int id)
        {
            HttpResponseMessage response = new HttpResponseMessage();
 
            using(var entity = VMProjectOnderhoud.GetById(this, Id))
            {
                entity.Delete();
 
                SaveChanges();
 
                response.StatusCode = HttpStatusCode.OK;
            }
 
            return response;
        }
 
        public object Create()
        {
            return null;
        }
 
        public object GetProjectRegelList (int id)
        {
            VMProjectOnderhoud entity = VMProjectOnderhoud.GetById(this, id);
 
            entity.LoadProjectRegelList();
 
            return Json(entity.ProjectRegelList, JsonRequestBehavior.AllowGet);
        }
    }
}





Paul
Top achievements
Rank 1
 asked on 14 Sep 2012
1 answer
441 views
How can I make it so that when I click on "Add New Item" it will open up a file browser and allow the user to select file/files that they want to upload.  Then when the user clicks "ok" it will async upload those files and adds it into the Grid as new row(s) for each new item(s).

Thanks.
Iliana Dyankova
Telerik team
 answered on 14 Sep 2012
8 answers
245 views
Are there any known PhoneGap + Kendo Mobile applications available for download from the App/Play Stores? I am evaluating Kendo as a framework for building web-based native applications, and would love to be able to try out some real-world examples.

Thanks,
Jason
moegal
Top achievements
Rank 1
 answered on 14 Sep 2012
1 answer
1.4K+ views
How would one go about cancelling the change event?

I need to check a variable when the change event is fired and depending upon the variable value:
  1. prevent the change event from bubbling/cancel the event 
  2. maintain the selected state of any rows that were selected prior to the change event firing

Any help would be appreciated.

Vladimir Iliev
Telerik team
 answered on 14 Sep 2012
1 answer
119 views
I'm trying to display large number of items using ListView (web). Solid view looks not good so I need to have striped list. 

Below script is not working

$("li:odd").css("background-color", "#202020");

How I can make ListView striped?
Nohinn
Top achievements
Rank 1
 answered on 14 Sep 2012
0 answers
129 views
json: 1.jpg
i want grid view is :2.jpg
when i select the cell,i want to get the dataitem like 1.jpg.
how to do?
thx!
xu
Top achievements
Rank 1
 asked on 14 Sep 2012
2 answers
1.4K+ views
Hello,

I am new to Kendo UI and want to start to create my 1st pie chart.
But If I run my webpage, I get following error from firebug:

$('#chart').kendoChart is not a function

This is what I include in the header:

<!doctype html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/css/kendo/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
    <link href="/css/kendo/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
 
    <script src="/kendo/js/jquery.min.js" type="text/javascript"></script
    <script src="/kendo/js/kendo.web.min.js" type="text/javascript"></script>      
  </head>

Do I miss a file to include?
What I thought is that I had to include kendo.dataviz.min.js, but this file does not come with the kendo package.
The files I have inside my kendo/js folder are attached as image.

Thank you for any help!
Mr
Top achievements
Rank 1
 answered on 14 Sep 2012
2 answers
114 views
I'm trying to create a feature which will auto-filter a grid using an input field in the toolbar.  The source can be found at http://jsbin.com/odudud/8.  

I have 2 questions:
  1. Each time I apply my manually-created filter, I get "Property '_parse' of object [object Object] is not a function 
    ".  Can you explain what I might be doing wrong to get this?
  2. Is there a way to filter a Number field so that I can search its contents (i.e., using 'contains' with a Number field)?
Thanks!
Darren
Top achievements
Rank 1
 answered on 14 Sep 2012
4 answers
934 views
function onEdit(e) {
       var id= $(e).attr("data-assumptionid");
        var window = $("#EditAssumptionWindow").data("kendoWindow");
        var assumption = findById(assumptions,id);
 
       window.refresh({
           data: {
               ID: assumption.ID,
               Term : assumption.Term,
               type : assumption.Type,
               unitID : assumption.UnitID,
               Name : assumption.Name
           }
       });
 
       window.open();
       window.center();
   }

Controller method
public ActionResult EditAssumption(Guid  ID, int Term, string Name, string type, int unitID)
        {
            ViewBag.Mode = "Edit";
            AssumptionDTO dto = new AssumptionDTO()
            {
                ID=ID,
                Name=Name,
                Term=Term,
                Type=type,
                UnitID=unitID
            };
            return PartialView("NewAssumption", dto );
        }

I am using the above to refresh the window when the user clicks an item and it works fine.

Is it possible to pass the object itself instead of each parameter individually? like below.  I need to do this because the assumption object is going to have an array that needs to be passed in as a parameter also.  Thanks,

function onEdit(e) {
       var id= $(e).attr("data-assumptionid");
        var window = $("#EditAssumptionWindow").data("kendoWindow");
        var assumption = findById(assumptions,id);
 
       window.refresh({
           data: {
               assumptionDTO: assumption
           }
       });
 
       window.open();
       window.center();
   }

Controller method
public ActionResult EditAssumption(AssumptionDTO dto)
        {
            ViewBag.Mode = "Edit";
            return PartialView("NewAssumption", dto );
        }

Alex Gyoshev
Telerik team
 answered on 14 Sep 2012
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
Date/Time Pickers
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)
SPA
Filter
Drawing API
Drawer (Mobile)
Globalization
Gauges
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
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
OrgChart
TextBox
Effects
Accessibility
ScrollView
PivotGridV2
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
Popover
DockManager
FloatingActionButton
TaskBoard
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
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?