I need to
1. copy/add an item from 1 dataset to another
2. dynamically pull individual items from dataset with the add item based id
The code below does this and works in safari and firefox. It does not work in IE. IE shows the item but not the value. If I put a default value in the schema, ie shows the default value. The problem appears to be the way the .add is handled in ie. Additionally, when I try to debug dsDrugsDosage in IE, it says binary object and won't let me interrogate it. Any guidance on how to debug this is appreciated.
I have a simple button that
Sample Code
1. copy/add an item from 1 dataset to another
2. dynamically pull individual items from dataset with the add item based id
The code below does this and works in safari and firefox. It does not work in IE. IE shows the item but not the value. If I put a default value in the schema, ie shows the default value. The problem appears to be the way the .add is handled in ie. Additionally, when I try to debug dsDrugsDosage in IE, it says binary object and won't let me interrogate it. Any guidance on how to debug this is appreciated.
function getData()
{
item = dsDrugs.get('1');
dsDrugsDosage.add(item);
}
I have a simple button that
Sample Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
title
></
title
>
<
meta
http-equiv
=
"X-UA-Compatible"
content
=
"IE=edge"
>
<
script
src
=
"../../../js/jquery.min.js"
></
script
>
<
script
src
=
"../../../js/kendo.mobile.min.js"
></
script
>
<
script
src
=
"../../content/shared/js/console.js"
></
script
>
<
link
href
=
"../../../styles/kendo.common.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"../../../styles/kendo.mobile.all.min.css"
rel
=
"stylesheet"
/>
<
script
>
var drugs =
[
{
"id": 1,
"name": "Epinephrine",
"price": 12.00,
"intratracheal": 1,
"category": "CPR",
"categoryid": 1,
"intravenous":2,
"featured": true
},
{
"id": 2,
"name": "Atropine",
"price": 21.00,
"intratracheal": 2,
"category": "CPR",
"categoryid": 1,
"intravenous":4,
"featured": false
},
{
"id": 3,
"name": "Naloxone",
"price": 4.00,
"intratracheal": 5,
"category": "Pain",
"categoryid": 2,
"intravenous": 2,
"featured": false
},
{
"id": 4,
"name": "Lidocaine",
"price": 12.50,
"intratracheal": 33,
"category": "Pain",
"categoryid": 2,
"intravenous": 3,
"featured": false
},
{
"id": 5,
"name": "Valium",
"price": 10.00,
"intratracheal": 4,
"category": "Anesthesia",
"categoryid": 3,
"intravenous": 77,
"featured": false
},
{
"id": 6,
"name": "Magnesium chloride",
"price": 4.00,
"intratracheal": 12,
"category": "ICU",
"categoryid": 2,
"intravenous": 3,
"featured": false
},
{
"id": 7,
"name": "Calcium chloride",
"price": 9.50,
"intratracheal": 13,
"category": "ICU",
"categoryid": 3,
"intravenous": 13,
"featured": false
},
{
"id": 8,
"name": "Glucose",
"price": 6.00,
"intratracheal": 13,
"category": "ICU",
"categoryid": 3,
"intravenous": 3,
"featured": false
},
{
"id": 9,
"name": "Shock volume of fluids",
"price": 17.00,
"intratracheal": 13,
"category": "Fluids",
"categoryid": 4,
"intravenous": 4,
"featured": false
},
{
"id": 10,
"name": "Maintenance volume of fluids",
"price": 7.75,
"intratracheal":13,
"category": "Fluids",
"categoryid": 4,
"intravenous": 44,
"featured": false
}
]
;
var schema = { model: {
id: "id",
fields: {
id: {
//this field will not be editable (default value is true)
editable: false,
// a defaultValue will not be assigned (default value is false)
nullable: true
},
name: {
defaultValue: "Error with Name",
},
intratracheal: {
},
intravenous: {
},
category: {
}
}
}
};
var dsDrugs = kendo.data.DataSource.create({
schema: schema,
data: drugs,
group: "category",
error: function () { alert(arguments); }
});
var dsDrugsDosage = kendo.data.DataSource.create({
data: [],
schema: schema,
group: "category",
error: function () { alert(arguments); }
});
dsDrugs.fetch();
function getData()
{
item = dsDrugs.get('1');
dsDrugsDosage.add(item);
}
function dosageResultsViewInit() {
$("#dosageresults-listview").kendoMobileListView({
dataSource: dsDrugsDosage,
template: $("#dosageResultsListViewTemplate").html(),
headerTemplate: "<
h2
> ${value}</
h2
>"
});
}
</
script
>
<
script
type
=
"text/x-kendo-template"
id
=
"dosageResultsListViewTemplate"
>
<
span
class
=
"item-title"
>${name}</
span
>
<
input
class
=
"item-info"
type
=
"text"
value
=
"#:intravenous#"
/>
<
input
class
=
"details-link"
type
=
"text"
value
=
""
#:intratracheal#" />
</
script
>
</
head
>
<
body
>
<
div
data-role
=
"view"
id
=
"drugresultsview"
data-layout
=
"mobile-view"
data-title
=
"Dosage Results"
data-init
=
"dosageResultsViewInit"
>
<
div
data-role
=
"header"
>
<
div
data-role
=
"navbar"
>
<
span
>Dosage Results</
span
> <
a
data-role
=
"button"
data-align
=
"left"
href
=
"#drugcalcview"
>
Back</
a
>
</
div
>
</
div
>
<
div
class
=
"head"
>
<
a
href
=
"javascript:getData()"
>GetData</
a
></
div
>
<
div
id
=
"drugresultsviewbg"
class
=
"k-content"
>
<
ul
id
=
"dosageresults-listview"
>
</
ul
>
</
div
>
</
div
>
<
script
>
window.kendoMobileApplication = new kendo.mobile.Application(document.body);
</
script
>
</
body
>
</
html
>