TextField rounds number strings problem

  1. #1

    TextField rounds number strings problem

    Hi,

    I'm creating a textfield with string values, the values are numbers with 17chars, but I'm facing a problem that the textfiled seems to convert them to int as a numberfield and rounds the last 3 numbers as below C# code and the string example:

    First I create a PropertyGridParameter and then add the textfield to it with the dunamic values. It saves the right values to the DB but the viewing values get rounded.Click image for larger version. 

Name:	extnet-textfield1.png 
Views:	174 
Size:	9.2 KB 
ID:	24223Click image for larger version. 

Name:	extnet-textfield2.png 
Views:	153 
Size:	9.1 KB 
ID:	24224

    var parameter = new Ext.Net.PropertyGridParameter()
    {
    	DisplayName = GetLangText(prop.PropertyDesc),
    	Name = prop.PropertyId.ToString(),
    	Value = companyProp != null ? companyProp.PropertyValue : null
    };
    var textField = new Ext.Net.TextField();
    textField.EnforceMaxLength = true;
    textField.MaxLength = 40;
    textField.ID = "TextField_" + prop.PropertyId;
    parameter.EditorType = Ext.Net.PropertyGridEditorType.String;
    parameter.Editor.Add(textField);
    The string value is:
    789124893465912650
    Get rounded to:
    789124893465912700

    At last I added EnforceMaxLength and MaxLength 40 but it didn't help. Any idea?
  2. #2
    Hi @eagleOne,

    Interesting. Could you, please provide a full test case to reproduce the problem? I would investigate in details.
  3. #3

    Hi @Daniil

    Sorry my late reply, what kind of test case you want me to send?
  4. #4
    Any standalone test case to reproduce the problem would be appreciated.
  5. #5

    Test code

    Hi,
    Here comes some code:

    HTML
    <ext:Container ID="ContainerProperty" runat="server" Layout="FitLayout">
    	<Items>
    		<ext:PropertyGrid ID="PropertyGrid_EditUser" runat="server" NameColumnWidth="300" Title="<%$ Lang: Properties %>" />
    	</Items>
    </ext:Container>
    C#:
    var parameter = new Ext.Net.PropertyGridParameter()
    {
      DisplayName = "WhatEverName",
      Name = "WhatEverId",
      Value = 0012
    };
    
    var textField = new Ext.Net.TextField();
    textField.ID = "TextField_" + prop.PropertyId;
    parameter.EditorType = Ext.Net.PropertyGridEditorType.String;
    parameter.Editor.Add(textField);
    parameter.Value.ToString();
    PropertyGrid_EditUser.Add(parameter);
    Click image for larger version. 

Name:	PropertyGrid1.png 
Views:	158 
Size:	12.4 KB 
ID:	24628Click image for larger version. 

Name:	PropertyGrid2.png 
Views:	130 
Size:	48.9 KB 
ID:	24629Click image for larger version. 

Name:	PropertyGrid3.png 
Views:	162 
Size:	13.4 KB 
ID:	24630
    Last edited by eagleOne; Jun 07, 2016 at 9:57 AM. Reason: More code
  6. #6

    After test

    Hi,
    After we made tests seems that the JSON converter in your library might not working as it should be, all strings that have a leading zero get converted to integer and assumed to be octal which is wrong.

    The type as I posted before is string and the value is string but presented wrong, here comes more test response:

    JSON:
    source:{"1":0013,"3":10,"4":"","5":"","8":"","10":"","12":"a0083","13":"","14":""},sourceConfig:{"1":{displayName:" Användarnamn i affärssystem",type:"string",editor:new Ext.grid.CellEditor(Ext.apply({field:{id:"TextFiel d_1",xtype:"textfield"}}, {}))}

    As you see the ID number 1 has value 0012 and the ID number 12 has value a0083. The ID number 1 get converted to 8 but the ID number 12 showes as it is.

    So my question is there any solution for it? Because I can not make anything from here unless I make my own code to override yours. Thanks.

    Regards;
  7. #7
    Hello @eagleOne,

    Thank you for the report and investigation.

    Could we, please, have a runnable test case to reproduce the problem?

    In your code piece Value = 0012 throws a compiler error: Cannot implicitly convert type 'int' to 'string'

    It appears to be an expected compiler error.

    This this.PropertyGrid_EditUser.Add(parameter); throws another error. Probably, this was meant:
    this.PropertyGrid_EditUser.Source.Add(parameter);

    By the way, is that a related bug report?
    https://github.com/extnet/Utilities/issues/1
  8. #8

    Live test case

    Hi @Daniil,
    I made a test user in our production site that have the problem. the link is http://portaladmin.hantverksdata.se and the user you use for login is: extnettest@hdata.se and password is: 123

    When you login you will see only this account and the site is auto-translated to english if you have English lang. set on your browser. you may test as we discussed earlier. You can see what I mean.

    Please inform me when are finished with testing. Thanks

    Click image for larger version. 

Name:	testuser1.png 
Views:	170 
Size:	13.5 KB 
ID:	24672Click image for larger version. 

Name:	testuser2.png 
Views:	125 
Size:	39.1 KB 
ID:	24673

Similar Threads

  1. [CLOSED] Export Excel Number Format Problem
    By ddeniz in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 09, 2014, 1:36 PM
  2. InputType Number problem
    By hakandonmez in forum 2.x Help
    Replies: 0
    Last Post: Jan 26, 2014, 8:10 AM
  3. Replies: 0
    Last Post: Nov 24, 2012, 10:45 PM
  4. [CLOSED] Allow only String and number only in TextField
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 12, 2012, 5:58 AM
  5. store or form turns null-strings into empty strings
    By hansweber2 in forum 1.x Help
    Replies: 0
    Last Post: Aug 25, 2009, 11:18 AM

Tags for this Thread

Posting Permissions