Jump to content

DBGrid Built-In PagingBar Added Button - How to change the icon image (outside of grid/pagingbar event) at runtime


andyhill

Recommended Posts

I have the following button added to the Grid's Built-In Paging Bar

             '    {'#13#10 +
             '      xtype: '#39'button'#39','#13#10 +
             '      icon: '#39'images/navigator/unfilter2.png'#39','#13#10 +
             '      width: 24,'#13#10 +
             '      height: 24,'#13#10 +
             '      tooltip: '#39'Filter'#39','#13#10 +
             '      handler: function() '#13#10 +
             '      {'#13#10 +
             '        ajaxRequest(sender, '#39'_Filter_'#39', []); '#13#10 +
             '      }  '#13#10 +
             '    },'#13#10 +
...

Subject to logic, change image

grdTest.JSInterface.JSCode --> icon: 'images/navigator/filter2.png'

grdTest.JSInterface.JSCode --> icon: 'images/navigator/unfilter2.png'

Please advise how I can change the icon image at runtime - Thanks in advance

Link to comment
Share on other sites

Yes, I understand I need to add id: "tstFilter" to Pagingbar button object.

I am trying to work out the syntax to change the Pagingbar icon with id: "tstFilter"

          grdTest.JSInterface.JSCode(#1'.pagingBar.tstFilter.setIcon(''images/navigator/filter-16.png'');');
 

Please advise

Link to comment
Share on other sites

Sherzod, I tried to implement based on your suggestion 

          grdTest.JSInterface.JSCode(#1'.pagingBar.getComponent("supFilter").setIcon("images/navigator/filter-16.png"');

FAILS, Error attached.

I moved it out of grdTest AjaxEvent into MainForm AjaxEvent - same error

  //////////////////////////////////////////////////////////////////////////////
  if SameText('_SuppFilter_', EventName) then begin
          grdTest.JSInterface.JSCode(#1'.pagingBar.getComponent("supFilter").setIcon("images/navigator/filter-16.png"');
  end;

Please advise - thanks

Error-2.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...