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

Change Field List

3 Answers 119 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Jeffrey
Top achievements
Rank 1
Veteran
Iron
Iron
Jeffrey asked on 15 May 2020, 03:04 PM

Hello

Is there a way to change out the Field List on the fly?

Do I use setOptions like other widgets to change out the field list or do i change the datasource?  

Anyone have an example?  The published API is a little limited.

Thank you

Jeff

3 Answers, 1 is accepted

Sort by
0
Jeffrey
Top achievements
Rank 1
Veteran
Iron
Iron
answered on 15 May 2020, 04:33 PM

Hello

Tried a few things and came up with the below:

var newfields = [];
newfields.push({name: "Field 1", type: "string", label: "NEW Field 1" });
var filter = $("#viewdialogfiltercreator").getKendoFilter().setOptions({
            expressionPreview: true,
            fields: newfields,
            applyButton: false
            //expression: existingwhereexpression
});
0
Angel Petrov
Telerik team
answered on 19 May 2020, 02:01 PM

Hello Jeff,

Indeed calling the setOptions method is the way to go for this scenario as the widget in this case will re-initialize everything inside thus applying the new changes. Do not hestitate us to contact us again if you have any queries in regards of our controls.

Regards,
Angel Petrov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Jeffrey
Top achievements
Rank 1
Veteran
Iron
Iron
answered on 27 May 2020, 10:12 PM

Hello

For those that follow...

This does not quite work.  It puts an error into the console. I had to create a datasource with all the fields and then tie the datasource to the filter.  

Tags
Filter
Asked by
Jeffrey
Top achievements
Rank 1
Veteran
Iron
Iron
Answers by
Jeffrey
Top achievements
Rank 1
Veteran
Iron
Iron
Angel Petrov
Telerik team
Share this question
or