FilterHeader not working with modelfield type object

  1. #1

    FilterHeader not working with modelfield type object

    I'm having problem with my filter header on grids that loads ModelFiled with type object, that means when I have an object as an Index and render the columnsvalues with javascript Render Handler and then try to filter in the grid with these columns the filter dose not work. Any idea to fix this?

    <ext:Store ID="id">
        <Model><ext:ModelField Name="Endpoints" Type="Object" /></Model>
    </ext:store>
    <ColumnModel ID="ColumnModel_Users" runat="server">
        <Columns>
            <ext:Column ID="ColumnEndpointName" runat="server" DataIndex="Endpoints" Text="EndpointName">                                               <Renderer Handler="return value.EndpointName" />
            </ext:Column>
        </Columns>
    </ColumnModel>
  2. #2

    Solution

    I solved this by make the render on Store -> Model more simple by not using Type="object" on the columns but instead making new ModelFields from the object ModelFiled by using the Convert function and render them as if they where simple ModelFields. :-) hope this helps, some code:

    <ext:ModelField Name="Endpoints" Type="Object" />
    <ext:ModelField Name="Groups" Type="Object" />
    <ext:ModelField Name="UserPropCompId">
      <Convert Handler="return userPropertyViewsRenderer(record.get('UserPropertiesViews'), 'EntreFtg');" />
    </ext:ModelField>
    <ext:ModelField Name="UserPropUser">
    	<Convert Handler="return userPropertyViewsRenderer(record.get('UserPropertiesViews'), 'EntreUser');" />
    </ext:ModelField>
    <ext:ModelField Name="EndpointName">
            <Convert Handler="return record.data.Endpoints ? record.data.Endpoints.EndpointName : '';" />
    </ext:ModelField>
    
    
    Javascript:
    userPropertyViewsRenderer = function (value, propName) {
    	var val = $.grep(value, function (e) { return e.PropertyName === propName; })[0];
    	if (val == undefined)
    		return '';
    	else
    		return val.PropertyValue;
    }

Similar Threads

  1. Replies: 4
    Last Post: May 01, 2014, 7:06 AM
  2. Replies: 5
    Last Post: Nov 18, 2013, 4:40 AM
  3. [CLOSED] Grid FilterHeader default type search
    By Aurelio in forum 2.x Premium Help
    Replies: 6
    Last Post: Oct 28, 2013, 2:39 PM
  4. Replies: 7
    Last Post: Oct 15, 2013, 11:35 AM
  5. Replies: 3
    Last Post: Jul 17, 2012, 1:44 PM

Tags for this Thread

Posting Permissions