Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7398183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:50:22+00:00 2026-05-29T03:50:22+00:00

In my custom filter function that I set by calling setFilter() on my DataView

  • 0

In my custom filter function that I set by calling setFilter() on my DataView, I did the following to troubleshoot a problem with my filtering algorithm:

function myFilter(item) {
    console.dir(item);
    console.dir(arguments);
}

To my surprise, I got the following output (pseudo-output):

  • Object – the actual item object
  • Arguments – a two-item array where the first item is the data set array (that DataView uses) and the second argument is undefined.

How can this (i.e. arguments[0] !== item) be?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T03:50:23+00:00Added an answer on May 29, 2026 at 3:50 am

    After spending hours scratching my head and contemplating on what I thought I knew about how functions work (while blaming my lack of sleep), I finally thought about checking SlickGrid code. I found out the hard way that SlickGrid recompiles the filtering function (using toString() and string massaging) for caching/optimization and therefore the actual arguments array doesn’t match the original method signature.

    As another side effect, you cannot use non-global variables that are bound to the closure of the filtering function.

    The proper way to bind variables to the closure of the filtering function is to use the setFilterArgs() method of DataView. The undefined I saw as the second item of the arguments array in my (recompiled) filtering function was actually a slot for receiving what’s passed through setFilterArgs().

    Update

    Here’s what SlickGrid does to the filter function. Test function:

    function (item) {
        // my code here
    }
    

    Recompiled version (reformatted for readability):

    function (_items, _args) {
        var _retval = [], _idx = 0;
        var item, undefined = _args;
    
        for (var _i = 0, _il = _items.length; _i < _il; _i++) {
            item = _items[_i];
    
            // my code here
        }
    
        return _retval;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I set a custom filter in my code to ignore accents and
I'm trying to create a custom function that I can place in a queryset
I have made a custom filter that is to fire on every action(request). So
I'm trying to add a custom filter to my RadGrid. I have a column,
I have a custom validation attribute derived from action filter attribute. Currently the attribute
I'm trying to create a MIME filter to do some custom processing of resources
I want to add a custom model method to the admin filter, however it
I have a custom SharePoint page with several dataviews. The dataviews essentially filter documents
I am working on a function in WP that searches the post content for
I 'd like to enable the user to apply a custom filter to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.