Good day to you all.
I am developing an icenium app in which I get data from an SQL Server. Now I do want to split this data into three different views and display them with different initial sorting.
Kind of
name age height weight
Joe 33 180cm 80 kg
Jane 28 170cm 50 kg
Baby 1 50cm 9 kg
View 1 Grid with
name age
View 2 Grid with
name height
View 3 Grid with
Name weight
I have two problems
1) the initial sorting does only work with the give code below for the first view I load
2) sorting works only on the first view I sort.
Any advice. Should I make 3 different API calls or can it be handled dynamicly
Markus
I am developing an icenium app in which I get data from an SQL Server. Now I do want to split this data into three different views and display them with different initial sorting.
Kind of
name age height weight
Joe 33 180cm 80 kg
Jane 28 170cm 50 kg
Baby 1 50cm 9 kg
View 1 Grid with
name age
View 2 Grid with
name height
View 3 Grid with
Name weight
I have two problems
1) the initial sorting does only work with the give code below for the first view I load
2) sorting works only on the first view I sort.
Any advice. Should I make 3 different API calls or can it be handled dynamicly
Markus
<!-- Gemeinden Steuerfüsse-->
<
div
data-role
=
"view"
id
=
"view-gemeinden-steuerfuesse"
data-init
=
"getGemeindeDaten('SteuerfussTotal')"
data-layout
=
"drawer-layout-gemeinden"
data-title
=
"Steuerfüsse"
>
<
div
data-role
=
"content"
class
=
"view-content"
>
<
div
id
=
"grid-gemeinden-steuerfuesse"
></
div
>
</
div
>
</
div
>
<!-- Gemeinden Einwohner-->
<
div
data-role
=
"view"
id
=
"view-gemeinden-einwohner"
data-init
=
"getGemeindeDaten('Einwohner')"
data-layout
=
"drawer-layout-gemeinden"
data-title
=
"Einwohnerzahlen"
>
<
div
data-role
=
"content"
class
=
"view-content"
>
<
div
id
=
"grid-gemeinden-einwohner"
></
div
>
</
div
>
</
div
>
<!-- Gemeinden Ausländeranetiel-->
<
div
data-role
=
"view"
id
=
"view-gemeinden-auslaender"
data-init
=
"getGemeindeDaten('Auslaenderanteil')"
data-layout
=
"drawer-layout-gemeinden"
data-title
=
"Ausländeranteil"
>
<
div
data-role
=
"content"
class
=
"view-content"
>
<
div
id
=
"grid-gemeinden-auslaender"
></
div
>
</
div
>
</
div
>
function
getGemeindeDaten(sortBy) {
var
dataSource =
new
kendo.data.DataSource({
type:
"json"
,
transport: {
read: {
data:{
Accept:
"application/json"
}
}
},
sort: {field: sortBy, dir:
"asc"
},
});
$(
"#grid-gemeinden-steuerfuesse"
).kendoGrid({
dataSource: dataSource,
sortable:
true
,
columns: [
{
field:
"Gemeinde"
,
title:
"Gemeinde"
,
width: 150,
attributes: {
style:
"text-align: left; font-size: 0.8em; "
},
headerAttributes: {
style:
"text-align: left; font-size: 1em; "
}
}, {
field:
"SteuerfussJahr"
,
title:
" Jahr"
,
width: 90,
attributes: {
style:
"text-align: left; font-size: 0.8em; "
},
headerAttributes: {
style:
"text-align: left; font-size: 1em; "
}
}, {
field:
"SteuerfussTotal"
,
title:
"Total"
,
width: 90
}
, {
template:
"<a href='http://www.web.statistik.zh.ch/cms_gp_neu/gpzh/index.php?p=gp&gem=#= Statistiklink #' target='_blank' style='font-size:0.8em;'>Quelle</a>"
,
title:
"Quelle"
}
]
});
$(
"#grid-gemeinden-einwohner"
).kendoGrid({
dataSource: dataSource,
sortable:
true
,
columns: [
{
field:
"Gemeinde"
,
title:
"Gemeinde"
,
width: 150,
attributes: {
style:
"text-align: left; font-size: 0.8em; "
},
headerAttributes: {
style:
"text-align: left; font-size: 1em; "
}
}, {
field:
"Einwohner"
,
title:
"Einwohner"
,
width: 90,
attributes: {
style:
"text-align: left;k font-size: 0.8em; "
},
headerAttributes: {
style:
"text-align: left; font-size: 1em; "
}
}
, {
template:
"<a href='http://www.web.statistik.zh.ch/cms_gp_neu/gpzh/index.php?p=gp&gem=#= Statistiklink #' target='_blank' style='font-size:0.8em;'>Quelle</a>"
,
title:
"Quelle"
}
]
});
$(
"#grid-gemeinden-auslaender"
).kendoGrid({
dataSource: dataSource,
sortable:
true
,
columns: [
{
field:
"Gemeinde"
,
title:
"Gemeinde"
,
width: 120,
attributes: {
style:
"text-align: left; font-size: 0.8em; "
},
headerAttributes: {
style:
"text-align: left; font-size: 1em; "
}
}, {
template:
"#=Auslaenderanteil# %"
,
field:
"Auslaenderanteil"
,
title:
"2012"
,
width: 70,
attributes: {
style:
"text-align: right; font-size: 0.8em;padding-right:10px;"
},
headerAttributes: {
style:
"text-align: right; font-size: 1em;padding-right:10px;"
}
}
, {
template:
"<a href='http://www.web.statistik.zh.ch/cms_gp_neu/gpzh/index.php?p=gp&gem=#= Statistiklink #' target='_blank' style='font-size:0.8em;'>Quelle</a>"
,
title:
"Quelle"
,
attributes: {
style:
"text-align: right; font-size: 0.8em;padding-right:10px;"
},
headerAttributes: {
style:
"text-align: right; font-size: 1em;padding-right:10px;"
}
}
]
});