EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: ahybits on July 01, 2015, 04:39:27 PM



Title: Gridview Data Property not working
Post by: ahybits 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?



Title: Re: Gridview Data Property not working
Post by: stworthy 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.


Title: Re: Gridview Data Property not working
Post by: ahybits 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
            });
        },


Title: Re: Gridview Data Property not working
Post by: ahybits 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":""}]},


Title: Re: Gridview Data Property not working
Post by: stworthy on July 04, 2015, 06:21:05 PM
Please look at this example http://jsfiddle.net/ctoxdv0c/. It works fine.