EasyUI Forum
May 17, 2024, 05:28:08 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: getting raw data from datagrid  (Read 10762 times)
jpierce
Jr. Member
**
Posts: 73


View Profile
« on: June 06, 2013, 10:38:36 AM »

Is there no way to avoid having all your datagrid data mashed down into Strings?  When my datagrid loads JSON data, it's in String, Number, boolean, null, etc.  But as far as I can tell, datagrid just treats that all as text.  Is there any way around this other than having my application know exactly what type of data each column should have in advance?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: June 06, 2013, 11:29:49 PM »

Some additional informations can be added in the column definition.
Code:
$('#dg').datagrid({
  columns:[[
    {field:'name',width:100,datatype:'string'},
    {field:'salary',width:100,datatype:'number',align:'right'}
  ]]
});

Calling 'getColumnOption' method and the user will be able to get the specified field option.
Code:
var col = $('#dg').datagrid('getColumnOption','name');  // the 'name' field option
alert(col.datatype);  // the 'datatype' property
Logged
jpierce
Jr. Member
**
Posts: 73


View Profile
« Reply #2 on: June 11, 2013, 07:40:58 PM »

Thanks.  I may have to create some system to extract the metadata from the table.  Unfortunate that it can't just preserve the original datatype but I guess I could see why.
Logged
jpierce
Jr. Member
**
Posts: 73


View Profile
« Reply #3 on: June 14, 2013, 08:34:41 AM »

Any chance of getting this added to the data-options you can set on the TH elements?  Would be a lot easier to code that way in my situation.
Logged
jpierce
Jr. Member
**
Posts: 73


View Profile
« Reply #4 on: June 14, 2013, 08:48:50 AM »

Wait, so does "datatype" not actually DO anything other than for ornamental purposes?  It seems that way to me.  I was really hoping for something the grid actually understood and would cause it to store the data as that type rather than string.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!