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

  • Home
  • SEARCH
  • 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 8329421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:46:52+00:00 2026-06-09T01:46:52+00:00

Below I’m trying to retrieve a specific category record in my data store for

  • 0

Below I’m trying to retrieve a specific category record in my data store for a category field in my grid based on what value is stored for that field’s (column’s) value. The value of “categoryId” returns “2”. Why isn’t findRecord returning the record? It displays “-1” for “category”. When I use it as a combo box store for a dropdown in my form, the record where key=2 exists. I ultimately want to find the record where key=2 and then return the value property, so it displays the value property of that record in my grid view.

FYI: The “key” property is the id of the category record and “value” property is the name of the category record that I want to show (or render in the grid cell).

Category store:

Ext.define('DropdownOption', {
    extend: 'Ext.data.Model',
    fields: [
        { name: 'key' },
        { name: 'value' }
    ]
});

var statusDropdownStore = new Ext.data.Store({
    proxy: new Ext.ux.AspWebAjaxProxy({
        url: '/track/Controls/Shared/GeneralService.asmx/GetDropdownOptions',
        actionMethods: {                
            read: 'POST'
        },
        extraParams: {
            user_login: authUser,
            table_name: '[status]'
        },
        reader: {
            type: 'json',
            model: 'DropdownOption',
            root: 'd'
        },
        headers: {
            'Content-Type': 'application/json; charset=utf-8'
        }
    })
});   

View (Ext.grid.Panel) columns:

            columns: [

                ... snip ...

                { text: 'Status', dataIndex: 'status', sortable: true, 
                    renderer: function(value, metaData, record, row, col, store, gridView) { 

                        var categoryId = record.get('status');
                        alert("categoryId: " + categoryId);  // displays "categoryId: 2"
                        if (categoryId > 0)
                        {
                            var category = statusDropdownStore.findRecord('key', categoryId);
                            alert("category: " + category);  // displays "category: -1" which usually means not found
                            //alert(category.get('value'));
                            return '';  // return value property of category record
                        }
                        else
                        {
                            return '';
                        }
                    } 
                },

                { text: 'Date Modified', dataIndex: 'date_modified', sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y') },

                ... snip ...

            ],

====================

8/1/2012 @ 5:21pm update:

Okay, the values are blank on grid initial load (meaning it hits the “return ”;” line of code. But when I go into the record, and click “Save”, all of the rows in the grid show the category name–using the new code below. As a side note, I used to have the id column named “key”, but I renamed it to “id”.

                { text: 'Status', dataIndex: 'status', sortable: true, 
                    renderer: function(value) { //, metaData, record, row, col, store, gridView) { 

                        if (value > 0) {
                            var r = statusDropdownStore.findRecord('id', value);
                            if (r != null)
                            {
                                var catName = r.get('value');
                                return catName;
                            }
                        }
                        return '';
                    } 
                },
  • 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-06-09T01:46:55+00:00Added an answer on June 9, 2026 at 1:46 am

    Your code looks totally fine, I do the same thing for renderers also:

    renderer: function(value) {
        if (value) {
            var record = refStore.findRecord('id', value),
                name = record.get('name');
            return name;
        }
    },
    

    Strange thing is that findRecord is supposed to return null if not found, not -1.

    The only thing I can think of is this from the docs:

    When store is filtered, finds records only within filter.

    Here is the model I use for that refStore (above):

    Ext.define('MyApp.model.Reference', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'id',    type: 'int'},
            {name: 'name',  type: 'string'},
            {name: 'active',type: 'bool'}
        ],
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is my form. Using jQuery I load a <select> element based on value
Below is my shell script that I am trying to execute using PLINK on
Below is code to an inherited ComboBox. The issue is that the ComboBox is
Below is how I retrieve the Request Parameter Map in JSF FacesContext context =
Below is the code that I am writing in HTML and I'm getting what
Below is the plugin code that i have tried to reuse from an old
below is my code for confirmation dialog and sending data with ajax. In this
Below is my excl data: A B c ... F G 1 test vb1
Below is a very simple AJAX request that works just fine until I put
below is a java script function and the html for the clicked item that

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.