jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Bug? 'groups' returns array of char after reordering groups
Tagged: bug, groups, groupschanged
This topic contains 11 replies, has 2 voices, and was last updated by Nicolas 11 years, 4 months ago.
-
Author
-
Hi!
I use the ‘groups’ property to get the datafields of the columns grouped. Here is an example of my code :
$(“#jqxgrid”).on(“groupschanged”, function (event) { var columnsGrouped = $(‘#jqxgrid’).jqxGrid(‘groups’); });
When I add a new group, ‘groups’ return an array of string with all the datafields of the columns grouped. But if I reorder the groups, the array contains an array of char instead of the datafield’s string of the column reordered.
Here a jsFiddle and how to reproduce :
1 – open your console
2 – reorder the groups, and look at the array returned by ‘groups’Regards
Hi Nicolas,
Sorry, but there is no bug regarding jqxGrid here.
var groups = $(‘#jqxgrid’).jqxGrid(‘groups’);
alert(groups + ” ” + groups.length);The Alert displays 2 after reordering the Grouped columns. That is the correct Number of Groups.
If you want to get the Array’s values, you can write:
alert(groups[0]); alert(groups[1]);
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/No, sorry may be I wasn’t clear enough. There will always be the right number of items in the array returned. But here is what will happen :
Before :
[‘lastname’, ‘firstname’]After reordering ‘firstname’ :
[[‘f’,’i’,’r’,’s’,’t’,’n’,’a’,’m’,’e’], ‘lastname’] :And if you reorder ‘lastname’ :
[
[‘f’,’i’,’r’,’s’,’t’,’n’,’a’,’m’,’e’],
[‘l’,’a’,’s’,’t’,’n’,’a’,’m’,’e’]
] :I just tried : if you use “alert(groups[0])”, it will show you the array of chars like a string. Use “console.log(groups)” with Google Chrome Dev Tool instead, you will see that the returned value isn’t a string, but an array of char.
Hi Nicolas,
Please, try what I wrote you. For us, that is not a bug. A string actually represents multiple chars. So if you have array of charts, you may simply type myArray.toString();
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter!
Yes I did. Look at this jsFiddle :
http://jsfiddle.net/hqs5s/2/On each “groupschanged” event, it outputs two things : a console.log() and an alert().
If you look only at the alert, you’ll always think it is fine. But look at you console, and you will see that the datafield of the column you just reorder isn’t a string, but an array of char.
Regards
Ok, Nicolas. I am not going to argue with you.
Thank you for the feedback!
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Sorry Peter, I didn’t want to bother you. May be there is something I didn’t explain well?
I thought the jsFiddle I sent would help. But you didn’t tell me if you looked at the result of the console.log() return in my example?
I’m 99% sure there is a problem, because I have it in my app and in the jsFiddle. Of course, I could just convert the array of chars in a string, but would it just be best to fix it in jqxGrid?
By the way, I know I sent a lot of topics about bugs. But you are doing a fantastic job! And the license we bought for jqxGrid saved us months of development! Thank you for this!
Regards!Just to add, may be this will be more clear!
Look at this image :
http://hpics.li/cb07f281 – First line, I added ‘firstname’ as a group
2 – second line, I added ‘lastname’ as a group
3 – third line, I added ‘productname’ as a group
4 – last line, I moved ‘productname’ from the third position to the second group position. Then, you clearly see that ‘groups’ didn’t return a string (‘productname’) but an array of chars.Most of my testing are in Chrome. But Firefox give me the same result.
It is me again! Sorry
I just tried it with IE9, and the console won’t show the problem! I don’t know for IE10+, but you have to try it with Chrome or Firefox.
The problem is still presents in IE, it just that their console join the array of chars so it looks like a string.
Hi Nicolas,
I added a new work item and added links to your fiddles. A developer from our Team will look into that behavior. Thank you again for the feedback!
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/The 3.1.0 seems to solve this issue! Wow, that was fast! Thank you for your great work!
I modified my jsFiddle to show the result :
http://jsfiddle.net/hqs5s/4/ -
AuthorPosts
You must be logged in to reply to this topic.