EasyUI Forum
May 16, 2024, 05:24:27 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Gridview Data Property not working  (Read 6162 times)
ahybits
Newbie
*
Posts: 26


View Profile
« on: July 01, 2015, 04:39:27 PM »

Hi,

I ahve

Code:
var dg = $('#dgNames').datagrid({      
            data: .............
            fitColumns: true,
            oneSelect: true,
            sortName: "completiondate",

Now with the data property, I can successfully bind one row and ONLY one row, no more than that.,  If I copy the same row, and make a second row, the UI shows the space for all the rows, but nothing is shown.  You cna use any set of data; can get this working.  Any Ideas?

Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 02, 2015, 04:10:29 AM »

The data must be an array or an object with 'total' and 'rows' properties. Please check your data carefully.
Logged
ahybits
Newbie
*
Posts: 26


View Profile
« Reply #2 on: July 02, 2015, 08:58:50 AM »

Am I missing something?  Maybe some bracket that I can see..... this is what I have: i copied the json I get and tried to hard code it here as well (confirmed it in jsonlint as well)

var dglh = $('#dgEducationCASupportLearningHoursharke11').datagrid({     
        data:  {"total":28,"rows":[{"lhid":"5409bf9ad155630688dc6563","CId":"","Description":"Guide to Accountability","Completed":"2011-12-08","Hours":1,"CreditHours":1,"ClassType":"Skills","State":"Active","Label":""},{"lhid":"5409bf9ad155630318dc6564","CId":"","Description":"Database Training","Completed":"2012-02-14","Hours":0.5,"CreditHours":0.5,"ClassType":"Unclassified","State":"Active","Label":""}........]},
        fitColumns: true,
        oneSelect: true,
        sortName: "completiondate",
        sortOrder: "desc",
        remoteSort: false,
        onHeaderContextMenu: function (e, field) {
            e.preventDefault();
            if (!cmenu) {
                createColumnMenu();
            }
            cmenu.menu('show', {
                left: e.pageX,
                top: e.pageY
            });
        },
Logged
ahybits
Newbie
*
Posts: 26


View Profile
« Reply #3 on: July 04, 2015, 08:10:49 AM »

Still Stuck

1 works
Code:
data:  {"total":1,"rows":[{"lhid":"5409bf9ad155630688dc6563","CId":"","Description":"Guide to Accountability","Completed":"2011-12-08","Hours":1,"CreditHours":1,"ClassType":"Skills","State":"Active","Label":""}]},


2 (or more) doesnt
Code:
data:  {"total":2,"rows":[{"lhid":"5409bf9ad155630688dc6563","CId":"","Description":"Guide to Accountability","Completed":"2011-12-08","Hours":1,"CreditHours":1,"ClassType":"Skills","State":"Active","Label":""},{"lhid":"5409bf9ad155630318dc6564","CId":"","Description":"Database Training","Completed":"2012-02-14","Hours":0.5,"CreditHours":0.5,"ClassType":"Unclassified","State":"Active","Label":""}]},
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: July 04, 2015, 06:21:05 PM »

Please look at this example http://jsfiddle.net/ctoxdv0c/. It works fine.
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!