jQuery UI Widgets Forums Angular addfilter in grid in popup

This topic contains 3 replies, has 3 voices, and was last updated by  Ivo Zhulev 5 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • addfilter in grid in popup #98761

    lebarillier
    Participant

    hi!
    i have this code :

     onShowButton(event: any): void {
        this.CampaignName = this.CampaignGrid.getrowdata(event.args.rowindex).otCampaignID;
        this.CampaignID = this.CampaignGrid.getrowdata(event.args.rowindex).oidObject;
        this.window.open();
        this.addfilter();
      }
    
     addfilter(){
        let filtertype = 'stringfilter';
        let filtergroup = new jqx.filter();
        let filter_or_operator = 1;
    
        let filtervalue = this.CampaignID;
        let filtercondition = 'contains';
        let filterCampaign = filtergroup.createfilter(filtertype, filtervalue, filtercondition);
        filtergroup.addfilter(filter_or_operator, filterCampaign);
        this.ComputerGrid.addfilter('oidCampaign', filtergroup, true); //this line have a probleme
        this.ComputerGrid.applyfilters();
        
      }
    
      //close Popup
      onHideButton(): void {
        this.clearFiltering();
        this.window.close();
      }
    
      clearFiltering(): void {
        this.ComputerGrid.clearfilters();
      }
    

    and when i open for the first time the popup with the grid inside. it’s like i don’t have filter.
    and in my console i have this error :
    “ERROR TypeError: Cannot read property ‘length’ of undefined
    at Function.each (http://localhost:55194/vendor.bundle.js:5013:5839)”
    but if i close my popup and reopen it , that works ! all is clear. somebody know why?
    thank you.

    addfilter in grid in popup #98764

    Stanislav
    Participant

    Hello lebarillier,

    Try settings a setTimeOut on the grid.
    That way it will have time to lead all the data.

    Best Regards,
    Stanislav

    jQWidgets Team
    http://www.jqwidgets.com/

    addfilter in grid in popup #98782

    lebarillier
    Participant

    Hello Stanislav,
    i understand why you say that but normaaly i can add my filter after the databinding complete.
    i initiate the grid on the page load, so i thinked i can add my filter even if the popup is close.
    am i wrong?
    yes probably. I’ll test the setTimeOut
    but is it better to use a promise on the window.open(); ?

    • This reply was modified 5 years, 3 months ago by  lebarillier.
    addfilter in grid in popup #98816

    Ivo Zhulev
    Participant

    Hi lebarillier,

    Yes, try calling the open of the window in a promise.

    Best Regards,
    Ivo

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.