How to translate data to another at load??

  1. #1

    【Closed】How to convert data to another at GridPanel load??

    Hi ,guys ! I have three problems :
    (1)How to translate data to another , just like ,I want to show "02" at Gridpanel but the datasource's data is "2"!
    Maybe I need to explain it as :
    specNo specver
    test111 2
    test123 1
    but ,when the gridpanel load, I want the result is :
    specNo specver
    test111 02
    test123 01
    Add: this gridpanel and column is create at server,so ,the event will take it at server !!
    (2):When dynamic create columns ,I can see the columns ,headers ,but I'an not seeing any data

    RecordField re = new RecordField(v_Status_English);
                re.Name = v_Status_English;
                re.Mapping = RecordFieldType.String.ToString();
                this.stoControlInfo.AddField(re);
    but ,I take it like this is OK :
    this.stoControlInfo.AddField(new RecordField("SPEC", RecordFieldType.String));
    Last edited by nysyzp; Dec 28, 2011 at 12:44 AM.
  2. #2
    Hi,

    I'm not sure that I understand the problem you have.

    Is the problem that you can't see any data in a GridPanel? Or is the problem that you can't "translate" a data?

    You should ensure you bind a correct data according to a type of Store's Reader and its RecordField-s.
  3. #3
    Thank you very much for you reply!

    Click image for larger version. 

Name:	Ext.png 
Views:	86 
Size:	5.6 KB 
ID:	3623
    The data is Ok and could show normally ,I just want one column's data convert to another format when GridPanel load ,for example ,the English convert to China or one code convert to always two code , if not ,add "0" at left !!

    This Columns and Recordfield is dynamically create at server !

    this.stoControlInfo.AddField(new RecordField("SPECNO", RecordFieldType.String));
    this.stoControlInfo.AddField(new RecordField("SPECVER", RecordFieldType.String));
    this.gpControlInfo.ColumnModel.Columns.Add(new Column { Header = "SPECNO", DataIndex = "SPECNO", Width = 100 });
    this.gpControlInfo.ColumnModel.Columns.Add(new Column { Header = "SPECVER", DataIndex = "SPECVER", Width = 80 });
    so ,I need you help !TKS !!
    Last edited by geoffrey.mcgill; Dec 26, 2011 at 4:36 AM. Reason: please use [CODE] tags
  4. #4
    Please see these two examples how to reconfigure a GridPanel.
    https://examples1.ext.net/#/GridPane...l/Reconfigure/
    https://examples1.ext.net/#/GridPane...e_Reconfigure/

    Though I'm not sure you need to reconfigure a GridPanel.

    Why do you add a new column if you want only to format an existing data? You should be able to just bind a new data.

    Also please clarify have you to format a data on server side or can it be done on client side?

    Generally speaking, we need more details about the requirement to suggest you a solution.
  5. #5
    Sorry!

    Let me ask you use another way!

    If I do it at client :
    <ext:Store ID="stoControlInfo" runat="server" GroupDir="ASC">
                    <Reader>
                        <ext:JsonReader>
                            <Fields>
                                <ext:RecordField Name="SYSID">
                                </ext:RecordField>                                                       
                                <ext:RecordField Name="ACTION">
                                <Convert Handler="if (value == 'Active') return '启用';                   //when  take it at client ,the GridPanel load normally,                                                  else if (value == 'Frozen') return '停用';                   //But  how could i do  when dynamically  create at  server???
                                                        " />
                                  </ext:RecordField>
                             </Fields>
                        </ext:JsonReader>
                    </Reader>
     </ext:Store>
    Like :
    this.stoControlInfo.AddField(new RecordField("ACTION", RecordFieldType.String));    //The data of columns  "ACTION"  is OK
    At server ,how to take "Handler"???
    If I take it as :
    RecordField re = new RecordField();
                re.Name = "ACTION";
                re.Mapping = RecordFieldType.String.ToString();
                this.stoControlInfo.AddField(re);                                             //The  data of Columns  "ACTION"  have  nothing,the other  columns  is    ok
    So ,Please help me how to do this problem!!

    TKank you again!!
    Last edited by Daniil; Dec 27, 2011 at 9:54 AM. Reason: Please use [CODE] tags
  6. #6
    It looks like this:

    Example
    RecordField r = new RecordField("name");
    r.Convert.Handler = "return value;";
    Store1.AddField(r);
  7. #7
    Thank you very much !

    I take it successfully follow yours!

Similar Threads

  1. [CLOSED] Stop treepanel to load data on page load
    By inayath in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 11, 2011, 10:17 AM
  2. [CLOSED] Translate password confirmation message
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 03, 2010, 6:11 PM
  3. how to load data to grid panel in page load
    By andylaiyongsing in forum 1.x Help
    Replies: 1
    Last Post: Apr 16, 2010, 10:27 AM
  4. [CLOSED] How to translate the labels to different laguages?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 10, 2010, 9:07 PM
  5. Replies: 4
    Last Post: Nov 17, 2008, 8:16 AM

Posting Permissions