or
<
div
id
=
"tabstrip"
>
<
ul
>
<
li
>First Tab</
li
>
<
li
>Second Tab</
li
>
</
ul
>
<
div
>First Tab Content</
div
>
<
div
>Second Tab Content</
div
>
</
div
>
<
div
id
=
"testInputs"
style
=
"clear:both; float:left"
>
<
div
style
=
"clear:both; float:left;"
>
<
br
/><
label
>Name:</
label
><
input
id
=
"inpUserName"
value
=
"n/a"
>
</
div
>
</
div
>
var
tabStrip = $(
"#tabstrip"
).kendoTabStrip().data(
"kendoTabStrip"
);
tabStrip.append(
[{
text:
"New Tab"
,
content: document.getElementById(
"testInputs"
).innerHTML
}],
tabStrip.tabGroup
);
$(
"#grid"
).kendoGrid({
dataSource: {
transport: {
dataType:
"jsonp"
,
read: {
}
},
schema: {
model: {
NUM:
"NUM"
,
fields: {
NOM: {
editable:
false
,
nullable:
true
},
DEP: {
editable:
false
,
nullable:
true
},
DEP: {
editable:
false
,
nullable:
true
},
DUE: {
editable:
false
,
nullable:
true
,
type:
"date"
},
START: {
//defaultValue: 42,
type:
"date"
},
COMP: {}
}
}
},
pageSize: 15,
serverPaging:
true
,
serverFiltering:
true
,
serverSorting:
true
},
height: 360,
toolbar: [
"save"
,
"cancel"
],
editable:
true
,
groupable:
true
,
scrollable:
true
,
sortable:
true
,
pageable:
true
,
selectable:
"row"
,
columns: [
{field:
"NUM"
, width: 20, title:
"Code"
},
{field:
"NOM"
, width: 150, title:
"Name"
},
{field:
"DEP"
,width: 40,title:
"Department"
},
{width: 30,title:
"Description"
, template:
"#=DESC#"
},
{field:
"DUE"
,width: 30,title:
"Due date"
},
{width: 50,title:
"Started"
, template:
"#=START#"
},
{width: 30,title:
"Completed"
,template:
'<div id="comp=#=NUM#" class="pop">Select</div>'
}]
});
$(
"#grid"
).kendoGrid({
dataSource: data,
height: 360,
toolbar: [
"save"
,
"cancel"
],
editable:
true
,
groupable:
true
,
scrollable:
true
,
sortable:
true
,
pageable:
true
,
selectable:
"row"
,
columns: [
{field:
"NUM"
, width: 20, title:
"Code"
},
{field:
"NOM"
, width: 150, title:
"Name"
},
{field:
"DEP"
,width: 40,title:
"Department"
},
{width: 30,title:
"Description"
, template:
"#=DESC#"
},
{field:
"DUE"
,width: 30,title:
"Due date"
},
{width: 50,title:
"Started"
, template:
"#=START#"
},
{width: 30,title:
"Completed"
,template:
'<div id="comp=#=NUM#" class="pop">Select</div>'
}]
});
var
window = $(
"#window"
);
var
windesc = $(
"#windesc"
);
$(
"#grid"
).click(
function
(){
$(
".pop"
).click(
function
(){
var
caseid = $(
this
).attr(
"id"
);
window.data(
"kendoWindow"
).refresh(
'date.php?'
+caseid);
window.data(
"kendoWindow"
).center();
window.data(
"kendoWindow"
).open();
});
});
$(
".desc"
).click(
function
(){
var
caseid = $(
this
).attr(
"id"
);
var
caseti = $(
this
).attr(
"ti"
);
windesc.data(
"kendoWindow"
).title(caseti);
windesc.data(
"kendoWindow"
).refresh(
'desc.php?'
+caseid);
windesc.data(
"kendoWindow"
).center();
windesc.data(
"kendoWindow"
).open();
});
#=DESC# & #=START#, the script load well a '<div id="test" class="pop">SELECT</div>' in dataSource but the html is not read and it appears as string in the cell if i use "field".
If i use the schema way, I got a "q is undefined" error.
If i use a template in columns, in firebug, i got an error "this is undefined" when i click on the cell..... If i load some local data with createData exemple function, the html is read and despite the "this" error is still there, the window open..... Cannot find how to solve that.
[WebMethod(EnableSession =
true
)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public
Item[] GetRecords2(
string
vn)
{
IDataView view = DatabaseSession.Current.GetOrCreateView(vn);
List<Item> items =
new
List<Item>(view.GetRecords(0, 40).Cast<IItemRecord>().Select(i =>
new
Item() { Code = i.Code, Description = i.Description }));
//count = view.RecordCount;
return
items.ToArray();
}
[WebMethod(EnableSession =
true
)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public
Item[] GetRecords3()
{
IDataView view = DatabaseSession.Current.GetOrCreateView(
"prd.item"
);
List<Item> items =
new
List<Item>(view.GetRecords(0, 40).Cast<IItemRecord>().Select(i =>
new
Item() { Code = i.Code, Description = i.Description }));
//count = view.RecordCount;
return
items.ToArray();
}
public
class
Item
{
public
string
Code {
get
;
set
; }
public
string
Description {
get
;
set
; }
}
$(document).ready(
function
() {
window.kendoMobileApplication =
new
kendo.mobile.Application(document.body);
$(
"#grid"
).kendoGrid({
dataSource: {
transport: {
read: {
type:
"POST"
,
url:
"/webservices/mobile.asmx/GetRecords3"
,
contentType:
"application/json; charset=utf-8"
,
data: {},
dataType:
"json"
}
},
schema: {
data:
"d"
,
model: {
fields: {
__type : { type:
"string"
},
Code: { type:
"string"
},
Description: { type:
"string"
},
}
}
},
error: onError
},
dataBound: ondataBound,
columns: [
{ title:
"Code"
, field:
"Code"
},
{ title:
"Description"
, field:
"Description"
}],
height: 300
});
$(document).ready(
function
() {
window.kendoMobileApplication =
new
kendo.mobile.Application(document.body);
$(
"#grid"
).kendoGrid({
dataSource: {
transport: {
read: {
type:
"POST"
,
url:
"/webservices/mobile.asmx/GetRecords2"
,
contentType:
"application/json; charset=utf-8"
,
data: { vn :
"prd.item"
},
dataType:
"json"
}
},
schema: {
data:
"d"
,
model: {
fields: {
__type : { type:
"string"
},
Code: { type:
"string"
},
Description: { type:
"string"
},
}
}
},
pageSize: 10,
serverPaging:
true
,
error: onError
},
dataBound: ondataBound,
columns: [
{ title:
"Code"
, field:
"Code"
},
{ title:
"Description"
, field:
"Description"
}],
height: 300
});