Is there a way to databind a listview group title. For styling purposes in my app its nice to use the grouped listview so that the title can be styled nicely like so ...
I would like to be able to databind the group title such that I change the text based on how many items are present (i.e. 'No Spiffy items' if datasource has 0 items ... etc). No problem I think databinding to the rescue ... I just make a computed dependency on my viewmodel and bind a span to that.
Sadly once databinding has done its thing the final output looks like this ...
My span is outside of the km-group-title and km-text so it doesn't get styled ...
Now I know I can just apply the styles to make it look appropriately but what is the proper way to achieve this affect?
<
ul
data-role
=
"listview"
data-style
=
"inset"
data-type
=
"group"
>
<
li
>
Spiffy Items
<
ul
data-role
=
"listview"
data-style
=
"inset"
data-bind
=
"source: spiffySource"
data-template
=
"spiffyTemplate"
></
ul
>
</
li
>
</
ul
>
<
ul
data-role
=
"listview"
data-style
=
"inset"
data-type
=
"group"
>
<
li
>
<
span
data-bind
=
"text: spiffySourceHeader"
></
span
>
<
ul
data-role
=
"listview"
data-style
=
"inset"
data-bind
=
"source: spiffySource"
data-template
=
"spiffyTemplate"
></
ul
>
</
li
>
</
ul
>
<
li
class
=
"km-group-container"
>
<
div
class
=
"km-group-title"
>
<
div
class
=
"km-text"
>
</
div
>
</
div
>
<
span
data-bind
=
"text: spiffySourceHeader"
>Found one Fuel Stop</
span
>
<!-- ul and its contents here snipped for brevity -->
</
li
>
Now I know I can just apply the styles to make it look appropriately but what is the proper way to achieve this affect?