Conditional data display

Page 1 of 2 12 LastLast
  1. #1

    Conditional data display

    Dear All,

    I have a situation where i don't want to display a particular if one of its column(eg. ColumnA) contain a value 'ABC' .

    If any row having this value in that particular column should not be displayed to the user. It has to be hidden.

    How can i achieve this?

    Thanks,
    Huzefa
  2. #2
    Which control do you want to restrict the rows by?

    You could at a high level:

    a) restrict the data before it hits the front end (via the query, or similar)
    b) filter the data in the store/grid on the front end using store.filter("Field", Value) for example
    c) manually loop over you grid/store at a set point (on load perhaps) and manually call something like store.removeAt() for the record if it matches your criteria
    d) use a renderer on the row, check for the value you don't want and hide the row if it's found

    I'd imagine one of those options would fit, but which would depend on your situation, can you provide some more info?
  3. #3
    Hi There,

    Hope the following snippet helps.

    Javascript fn for column display validation -

    <ext:XScript runat="server">
      <script type="text/javascript" language="javascript">
    
          ValidateColumnDisplay = function (value) {
    
              var grid = #{grdCountry};
    
              if (grid != null) {
                  if (this.editor.hidden == false) {
                      if (value == 'YourValueToValidate') {
                        this.hidden=true;
                        this.hideable= false;
                      }
                  }
              }
    
              return value;
          }
      
      </script>
    </ext:XScript>
    Column specific renderer invocation -

                                        <ext:Column ColumnID="CountryCode" Header="Country Code (English)" 
                                            DataIndex="CountryCode" Width="135px"> 
                                            <Editor> 
                                                <ext:TextField runat="server" AllowBlank="true"/> 
                                            </Editor> 
                                            <Renderer Fn="ValidateColumnDisplay"/>
                                        </ext:Column>
    Goodluck
  4. #4
    Sorry for not being clear on this matter. Actually I was talking about gridpanel control.

    I think the renderer on row should do great.
    Can you please give me a sample code that I should write for hiding the row.
    The column name is "State" and the value should be "deleted" in order to hide the row.

    Regards,
    Huzefa
  5. #5
    Quote Originally Posted by huzzy143 View Post
    Sorry for not being clear on this matter. Actually I was talking about gridpanel control.

    I think the renderer on row should do great.
    Can you please give me a sample code that I should write for hiding the row.
    The column name is "State" and the value should be "deleted" in order to hide the row.

    Regards,
    Huzefa
    Did the sample codes served your purpose?
  6. #6
    Yep I think it should do.I will test this and let you know.
  7. #7
    Quote Originally Posted by huzzy143 View Post
    Yep I think it should do.I will test this and let you know.
    Sure. Take your time. Goodluck.
  8. #8
    I think this should hide that particular column but in my case I want hide the entire row.
    What should be the modified code to hide the row instead of the column.
  9. #9
    Quote Originally Posted by huzzy143 View Post
    I think this should hide that particular column but in my case I want hide the entire row.
    What should be the modified code to hide the row instead of the column.
    Sorry. I must have misunderstood your requirement. Please follow this thread - http://forums.ext.net/showthread.php...de-row-in-Grid . This should fulfill your need.
  10. #10
    Thanx the solution at that link did work for me great.

    Regards,
    Huzefa
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: Feb 21, 2012, 8:13 AM
  2. Replies: 1
    Last Post: Aug 01, 2011, 10:08 AM
  3. Replies: 1
    Last Post: Apr 30, 2010, 3:11 PM
  4. Conditional display of menu
    By olakara in forum 1.x Help
    Replies: 2
    Last Post: Apr 15, 2010, 3:23 AM
  5. Replies: 11
    Last Post: Apr 06, 2009, 4:35 AM

Tags for this Thread

Posting Permissions