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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:05:35+00:00 2026-06-13T07:05:35+00:00

environment: 1.EasyUI Datagrid 2.jsp(s2sh) 3.mysql //until now i can populate the datagrid plugin with

  • 0

environment:

1.EasyUI Datagrid
2.jsp(s2sh)
3.mysql 
//until now i can populate the datagrid plugin with json object normally but a 
  small issue.

describe:

i got a Json-data-object returned from server,like below:

{"total":28,"rows":[{"productid":"1","attr":{"size":"10dc","color":"red&yellow"},
                    {"productid":"2","attr":{"size":"102dc","color":"green&null"}

with the plugins:

$(document).ready(function(){
      $('#tt').datagrid({  
        url:'loadVerifyStream.eAction',
        pagination:true,
        columns:[[  
                {field:'productid',title:'Product ID',width:100},  
                {field:'?????',title:'Product Size',width:250},  
                {field:'?????',title:'product Color',width:100},
       ]]  

});
});

i can’t output ‘Size’ and ‘Color’ attrs to the Grid,I tried

{field:'attr.size',title:'Product Size',width:250},
{field:'attr.color',title:'product Color',width:100},

no work.

anyone knows how to solve this ?
thanks in advance.

//—————————————–
I think i figured this issue out already.

refer to DataGrid’s API:

{field:'color',title:'product Color',width:100,
   formatter:function(val,rec){
   return rec.attr == null ? "":rec.attr.color;

}}

  • 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-13T07:05:36+00:00Added an answer on June 13, 2026 at 7:05 am

    This is a more general solution:

    say your json object is the following:

    [{id:3,client:{name: "John",city:'New York'},
    [{id:4,client:{name: "Paul",city:'Paris'}]
    

    to get the field name in your fomatter function, use this markup:

    <table id="dg">
        <thead>  
          <tr>
            <th field="id" width="50">ID</th>
            <th field="not used" formatter="(function(v,r,i){return formatColumn('client.name',v,r,i);})" width="50">Client name</th>
            <th field="not used" formatter="(function(v,r,i){return formatColumn('client.city',v,r,i);})" width="50">Client city</th>
          </tr>  
        </thead>  
    </table>
    

    then define formatColumn

    function formatColumn(colName, value, row, index) {
        return eval("row."+colName");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Environment: Rails 3.0.1 Ruby 1.8.7 MySQL 5.5.16 Community server...Jdk 1.6 gem 'sunspot_rails' gem 'sunspot_solr'
Environment: Visual Studio 2008 SP1 How can I write the following regex? I'm trying
Environment: RHEL 5 servers, MySQL 5.1.43, PHP 5.1.6 (using MySQLi). Currently only available within
Environment: Android 2.3.3 with Google API I know this is kind of long, but
Environment: IDE: Eclipse IDE for Java Developers 3.7.1 Plugin: ADT 14.0.0.v2011101719 Host: Fedora 13
Environment: Win32, C/C++ All three (3) can be used for a thread to signal
Environment: MacOS, gcc, Vim7.2 I know I can do it in Emacs. Compile code
Environment: Rails 3.0.1, MySQL I have a Users table, and I want to search
Environment: Windows Server 2008 R2 on Amazon EC2 Netbeans IDE with Glassfish started on
Environment I am using the native document management integration between Microsoft Dynamics CRM 2011

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.