Showing a value on a grid that doesn't belong to the associated store

  1. #1

    Showing a value on a grid that doesn't belong to the associated store

    Hi everyone,


    i have a problem using a grid. Maybe is a bit odd, but here it goes.


        public class Person
        {
            public int ID { get; set; }
            public string Name { get; set; }
            public int IDCountry {get; set;}
        }
    
        public class Country
        {
            public int IDCountry { get; set; }
            public string CountryName { get; set; }
          
        }

    Let's assume i have this 2 classes. On my aspx, i have a store that receives a datasource, List<Person>.
    In the grid that uses that store, how can i show the countryName instead of the countryID that is associated with that person?

    In trying to use <Renderer> to call an Ajax function that receives the ID and return either de countryName or the whole Country obj. Like in the example, i can make a Ext.Ms appear afer de responser from the server, but i can write the country name on the column.

    Any ideas?

    Thanks,
    Nuno Santos






  2. #2

    RE: Showing a value on a grid that doesn't belong to the associated store

  3. #3

    RE: Showing a value on a grid that doesn't belong to the associated store

    Hi Vladimir,

    fast reply. :)

    I miss that example completely.

    I try to reproduce that making the changes for my case, but i get an error in javascript, saying that the StoreCombo is not defined ( on the Fn function).



    Can you help me?

    Thanks,
    Nuno Santos
  4. #4

    RE: Showing a value on a grid that doesn't belong to the associated store

    You need define own *store which contains Countries*
  5. #5

    RE: Showing a value on a grid that doesn't belong to the associated store

    Hi,


    I did and the error occurs when the javascript try to get the country by id.


    Thanks,
  6. #6

    RE: Showing a value on a grid that doesn't belong to the associated store

    Hi,


    I solved this problem.

    Instead of having a function, i wrote all the code in the handler itself, taking advantage of the #{} syntax.

    So, may handler look like this:

    <Renderer Handler="var r = #{StoreCountry}.getById(value); return Ext.isEmpty(r) ? '': r.data.CountryName;" />

    If someone have the same problem, this solution is working for me.

    Nevertheless thanks very much Vladimir for putting me on the right track.


    Nuno Santos

Similar Threads

  1. GridPanel showing data return Store.Count value 0
    By abhi_sheklohiya in forum 1.x Help
    Replies: 3
    Last Post: Mar 26, 2012, 7:06 PM
  2. Replies: 1
    Last Post: Jan 15, 2012, 6:58 AM
  3. Replies: 1
    Last Post: Nov 19, 2011, 8:32 AM
  4. Replies: 1
    Last Post: Nov 25, 2009, 9:09 AM
  5. Grid rows not showing
    By myron in forum 1.x Help
    Replies: 16
    Last Post: Apr 27, 2009, 9:49 AM

Posting Permissions