This is a migrated thread and some comments may be shown as answers.

Grid-sortable / filterable?

7 Answers 538 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 28 Mar 2012, 02:53 PM
Hi,

Another GridView MVVM query from me! I've got my Kendo Grid working via MVVM, which uses the grouping / paging fine (data-groupable / data-pageable / sortable), but for filtering columns I can't seem to find a property that works and this is not documented anywhere I can find. I've tried data-filterable to no avail.

Has anyone found the correct syntax for this?

7 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 28 Mar 2012, 03:52 PM
Hello,

 Setting sortable should work out of the box. Filterable however cannot be currently set due to an omission on our end. Fortunately it is easy to work around this issue. Here is a running demo: http://jsfiddle.net/korchev/kEqYh/2/ 

All the best,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chris
Top achievements
Rank 1
answered on 28 Mar 2012, 04:17 PM
Amazing, thank you! Helped me a lot.

Sorry, one more thing though - for individual columns that you don't want to be filterable and are data-columns, "filterable": "false" does not work. Is there another workaround for this?
0
Atanas Korchev
Telerik team
answered on 28 Mar 2012, 04:24 PM
Hi,

 Actually it works: http://jsfiddle.net/korchev/kEqYh/3/ 

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Chris
Top achievements
Rank 1
answered on 28 Mar 2012, 04:35 PM
Ahhh, great! I was trying "false" as I've always had errors without using the " " quotes in the data-columns. The boolean representation works fine though. Thank you very much!
0
Richard
Top achievements
Rank 1
answered on 03 Jun 2012, 11:18 AM
The fiddle shows the data-source of a grid can be configured using a 'run-on' value with everything jammed together:
data-source='{"schema":{"model":{"fields":{"name":{}, "age":{"type":"number"}}}}}'

Is it possible to have a more readable attribute value for setting up the data source ?

Something like:
<div id="grid"
data-role="grid"
data-sortable="true"
data-filterable="true"
data-bind="source: data"
data-source='
{ "schema":
{ "model":
{ "fields":
{ "name":{}
, "age":
{ "type":"number"}
}
}
}
}'
>The
</div>​

Is there a web standard or other rule of the road that recommends not using a multi-line  attribute value ?

The sources indicate something special can happen when the attribute value starts with [, but I'm not sure what the specifics are.
Or the one of the following methods could be modified to strip out newlines from the attribute value before processing:
- expr
- initWidget
- parseOption
- getAttribute
0
Atanas Korchev
Telerik team
answered on 04 Jun 2012, 07:55 AM
Hi,

 If you are using the service pack release this should work: http://jsfiddle.net/korchev/kEqYh/24/ 

There is a problem however when the opening { is on a new line (as in your case). We will fix this for our next internal build.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Richard
Top achievements
Rank 1
answered on 04 Jun 2012, 11:44 AM
Atanas:
Fantastic! Thank you.
Tags
MVVM
Asked by
Chris
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Chris
Top achievements
Rank 1
Richard
Top achievements
Rank 1
Share this question
or