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

Including the Expression Preview in parameters via read transport jQuery

3 Answers 248 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 25 Feb 2021, 05:12 PM

     What I assumed would be fairly straightforward has vexed me for several days now -

I'm trying to pass the Expression Preview string along with some additional custom security vars when the filter is loaded and obviously when re-applied.  

I've tried filter.getOptions, sender._previewContainer, I even tried $( '.k-filter-preview' ).text() but I am running into issues of inconsistency regarding timing of availability.

My JS/jQuery is mediocre as its really only been my secondary, or even tertiary, approach of choice, until very recently so feel free to add ...dummy to an suggested resource.  :)

Thanks.

3 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 25 Feb 2021, 05:17 PM

I REALLY should have mentioned the fact that I am using the Filter function.

Here is the opening section to datasource definition if it help:

let ds = new kendo.data.DataSource( {
transport :  {
read : {
url :      "..."
dataType : 'json'
}, parameterMap :
   function( data, type ) {
return {filter:kendo.stringify(  data )};
}
}

 

and the filter def.

$( "#filter" ).kendoFilter( {
    dataSource :        ds,
    expressionPreview : true,
    applyButton :       true,
    expression :        {
    logic :   "and",
    filters : [
        { field : "ISACTIVE", value : true, operator : "eq" },
        { field : "ISARCHIVED", value : false, operator : "eq" }
    ]
}});

0
Kevin
Top achievements
Rank 1
answered on 25 Feb 2021, 10:37 PM

Just so no-one wastes their time considering a response, for now I've managed to put together a rather ugly workaround via dataSource.data().push inside the $( "#filter" ).kendoFilter [as well as a localStoarge load click event].

Best,

Kevin

0
Accepted
Nikolay
Telerik team
answered on 02 Mar 2021, 02:20 PM

Hello Kevin,

The most straight forward approach of getting the Expression Preview string is via the _previewContainer() method:

var filter = $("#filter").data("kendoFilter")
var text = filter._previewContainer.text()

Let me know if I am missing something. Feel free to modify the above Dojo to showcase the problem.

Regards,
Nikolay
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Filter
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or