Hi,
I need to create unique grid name inside template, i try with javascript, but it doesn't work.
<
script
id
=
"conditionGroupTemplate"
type
=
"text/x-kendo-template"
>
@(Html.Kendo().Grid<
Rule.ConditionViewModel
>()
.Name("entryGroupConditions" + //here i need to call getGUID()//)
.Columns(columns =>
{
columns.Bound(o => o.Text);
columns.Command(command =>
{
command.Destroy();
}).Width(110);
})
.ToolBar(toolbar =>
{
toolbar.Template("<
div
class
=
'toolbar'
><
a
class
=
'k-button k-button-icontext pull-left'
onClick
=
'AddGroup(\"\\#entryGroupConditions\", \"Skupina podmínek\")'
><
span
class
=
'k-icon k-add'
></
span
>Přidat skupinu</
a
><
h3
>AND</
h3
></
div
>");
})
.ClientDetailTemplateId("conditionTemplate")
.AutoBind(false)
.DataSource(ds => ds
.Ajax()
.Model(m => m.Id(o => o.Path))
.Destroy(del => del.Action("DeleteAttribute", "Rule"))
)
.Resizable(resize => resize.Columns(true))
.ToClientTemplate()
)
</
script
>
function getGUID(){
return (salt() + salt() + "-" + salt() + "-4" + salt().substr(0,3) + "-" + salt() + "-" + salt() + salt() + salt()).toLowerCase();
}
function salt(){
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
Any help?
thanks