property.
Column definitions in the grid look like:
columns:[
{field:"Name", title:"Product"},
{field:"IsValid", title: "State"}
]
What I actually want is a column that should behave like:
{field:"IsValid", title: "State"
, template: {
function(model) {
if(model.IsValid && model.Count > 0)
return "<img src ='images/good.png'/>";
else return "<img src ='images/bad.png''/>";
}
}
}
According to the - much better - documentation, "template" property expects a string, but is it possible to add some JavaScript code to the template string as well, something like
var imgTemplate = kendo.template(
"#if (model.IsValid && model.Count > 0){#<img src='icons/A.png'/>#}#else {#<img src='icons/B.png'/>#}
#");
and in the columns definitiontemplate: imgTemplate(model)
public class BusinessUserAccountModel : BusinessUserBaseModel
{
public IEnumerable<Accounts> Accounts { get; set; }
public BusinessUserAccountModel(){}
public BusinessUserAccountModel(BusinessData businessData,IEnumerable<Accounts> accts) : base(businessData, BusinessTab.Accounts)
{
Accounts = accts;
}
}
As you see above BusinessUserAccountModel is further inheriting BusinessUserBaseModel. If somehow in my grid CRUD operations if i able to pass BusinessUserAccountModel class along with the Accounts Collection that will solve my problem.
Just for more clarification in my page I have other controls in my page other than grid, so whenever I do CRUD operation in the grid those controls validation should also get fired. Hope you got cleared with my problem.
Thanks,
Nandan
{
id : "1",
name : "Ted",
collection : [ { id :"1" , name : "Picture 1 "}, { id :"2" , name : "Picture 2 "}]
}
Roles:<
select
id
=
"roles"
data-bind
=
"source: roles, value: role"
data-text-field
=
"roleName"
data-value-field
=
"roleId"
></
select
>
</
div
>
$(document).ready(function() {
var viewModel = kendo.observable({
roles: [ {
roleName:"Admin",
roleId:1
},
{
roleName:"user",
roleId:2
}],
Accesses:[{
accssesName:"read",accessMode:true},
{accssesName:"Write",accessMode:false},
{accssesName:"Delete",accessMode:false}
]
});
kendo.bind($("#example"), viewModel);
var roles=[
{
roleName:"Admin",
roleId:1
},
{
roleName:"user",
roleId:2
}
];
var roledataSource= new kendo.data.DataSource({
roles:roles
});
});
$(
'#divid')..data("kendoWindow"), it is giving null error. if i create the kendo window in the page itself in a script tag, iam able to access the data object but if i do the same in seperate js file, i am not able to. Is there any problem with this type of creating? Please help me out. Following is code snippet in my .js file.
$(
'[data-class=MyModal]').click(openmodal);
function openmodal(event) {
var dialog = $('#divid');
debugger;
if (dialog.length == 0) {
dialog = $(
'<div id="divid" style="display:none"></div>').appendTo('body');
}
dialog.kendoWindow({
modal:
true,
title: "Some Title"
,
actions: [
"Close"],
draggable: true
,
resizable: true
,
height: "400px"
,
width: "400px"
,
content: "myurlofsomepagewithinsamedomain",
});
dialog.data(
"kendoWindow").center();
dialog.data(
"kendoWindow").open();
}
event.preventDefault();
}