or
$(
"#treeview"
).on(
"click"
,
":checkbox"
,
function
(e) {
var
treeView = $(
"#treeview"
).data(
"kendoTreeView"
);
origChecked = listChecked;
listChecked = [];
checkedNodeIds(treeView.dataSource.view(), listChecked);
if
(searchLimited && listChecked.length > searchLimit) {
var
newChecked = $(listChecked).not(origChecked).get();
$.each(newChecked,
function
(index, value) {
var
item = treeView.dataSource.get(value);
item.set(
"checked"
,
false
);
});
e.preventDefault();
listChecked = origChecked;
}
});
// function that gathers IDs of checked nodes
function
checkedNodeIds(nodes, checkedNodes) {
for
(
var
i = 0; i < nodes.length; i++) {
if
(nodes[i].checked) {
if
(nodes[i].id !=
"0"
) {
checkedNodes.push(nodes[i].id);
}
}
if
(nodes[i].hasChildren) {
checkedNodeIds(nodes[i].children.view(), checkedNodes);
}
}
}
<!DOCTYPE html>
<
html
>
<
head
>
<
link
href
=
"bootstrap.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"kendo.common.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"kendo.bootstrap.min.css"
rel
=
"stylesheet"
/>
<
script
type
=
"text/javascript"
src
=
"jquery.min.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"kendo.all.min.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"bootstrap.min.js"
></
script
>
</
head
>
<
body
>
<
div
id
=
"gridModal"
></
div
>
<
div
id
=
"transaction"
></
div
>
</
body
>
</
html
>
<
script
type
=
"text/x-kendo-template"
id
=
"template"
>
<
div
>
<
div
>
<
div
>
Current Transaction Fee
</
div
>
<
div
>
<
input
id
=
"locationFeeAmount"
data-bind
=
"value: locationFee"
>
</
div
>
<
a
id
=
"toModal2"
type
=
"button"
class
=
"k-button k-button-icontext"
onclick
=
"showSecondModal();"
>To Modal 2</
a
>
</
div
>
</
div
>
</
script
>
<
script
type
=
"text/x-kendo-template"
id
=
"modal2"
>
<
div
>
<
div
>
<
div
>
Cuurent Transaction Fee:
</
div
>
<
div
>
<
input
value=#=locationFee #>
</
div
>
<
button
class
=
"k-button"
id"toModal2"></
button
>
</
div
>
</
div
>
</
script
>
<script>
$(
function
() {
var
locationFeeAdjustments = [{
"CustomerName"
:
"Fred Flinstone"
,
"CustomerNumber"
: 123456234,
"CustomerTransactionNumber"
: 2323423456789,
"RepName"
:
"Bugs Bunny"
,
"CustomerBill"
: 34454.55,
"locationFee"
: 89.22,
"testField"
:
"Bugs"
},
{
"CustomerName"
:
"Joe Smith"
,
"CustomerNumber"
: 123434456,
"CustomerTransactionNumber"
: 23456234556789,
"RepName"
:
"Jack Smith"
,
"CustomerBill"
: 34454.55,
"locationFee"
: 89.22,
"testField"
:
"Jack"
}];
$(
"#gridModal"
).kendoGrid({
dataSource:{
data: locationFeeAdjustments,
schema: {
model: {
id:
"Id"
,
fields: {
CustomerName: { type:
"string"
},
CustomerNumber: { type:
"number"
},
CustomerTransactionNumber: { type:
"number"
},
RepName: { type:
"string"
},
CustomerBill: { type:
"string"
},
locationFee: { type:
"string"
}
}
}
}
},
pageable:
true
,
height: 430,
toolbar: [
"create"
],
columns: [
{ field:
"CustomerName"
, title:
"Customer Name"
},
{ field:
"CustomerNumber"
, title:
"Customer Number"
},
{ field:
"CustomerTransactionNumber"
, title:
"Customer Transaction Number"
},
{ field:
"RepName"
, title:
"Officer Name"
},
{ field:
"CustomerBill"
, title:
"Bill Due"
},
{ field:
"locationFee"
, title:
"Location Fee"
},
{ command: {text:
"Waive Location Fee"
, click: showTransactionModal}}],
editable:
"inline"
,
save:
function
() {
this
.refresh();
}
});
wnd = $(
"#transaction"
)
.kendoWindow({
title:
"Transaction Fee"
,
modal:
true
,
visible:
false
,
resizable:
false
,
width: 300
}).data(
"kendoWindow"
);
detailsTemplate = kendo.template($(
"#template"
).html());
function
showTransactionModal(e) {
e.preventDefault();
var
dataItem =
this
.dataItem($(e.currentTarget).closest(
"tr"
));
kendoWindowViewModel = setViewModel(dataItem);
wnd.content(detailsTemplate(kendoWindowViewModel));
console.log(kendoWindowViewModel);
wnd.center().open();
};
});
function
setViewModel(dataItem){
var
kendoWindowViewModel = kendo.observable({
CustomerName: dataItem.CustomerName,
CustomerNumber: dataItem.CustomerNumber,
CustomerTransactionNumber: dataItem.CustomerTransactionNumber,
CustomerBill: dataItem.CustomerBill,
locationFee: dataItem.locationFee,
Approver:
""
,
AdjustmentAmount:
""
});
return
kendoWindowViewModel;
}
function
showSecondModal(){
console.log(
'hit'
);
console.log(kendoWindowViewModel);
}
</script>