jQWidgets Forums
jQuery UI Widgets › Forums › Grid › "sortable" crashes my Grid
This topic contains 4 replies, has 2 voices, and was last updated by swisspen 11 years, 11 months ago.
-
Author
-
Hi
I have a grid that works perfectly, using the code almost verbatim the way your demo does:
$(document).ready(function ()
{
// prepare the data
var source =
{
datatype: “json”,
datafields: [
{ name: ‘id’},
{ name: ‘name_first’},
{ name: ‘name_last’},
{ name: ‘activity_id’},
{ name: ‘activity_short_code’},
{ name: ‘activity_name’},
{ name: ‘capacity’}
],
url: ‘stcg-json-responses.php?eventId=’//rest of line truncated
sortcolumn: ‘name_last’,
sortdirection: ‘asc’
};
$(“#jqxgrid”).jqxGrid({
width: 900,
height: 450,
source: source,
//sortable: true,
theme: ‘classic’,
columns: [
{ text: ‘ID’, datafield: ‘id’, width: 50 },
{ text: ‘First Name’, datafield: ‘name_first’, width: 100 },
{ text: ‘Last Name’, datafield: ‘name_last’, width: 150 },
{ text: ‘Short Code’, datafield: ‘activity_short_code’, width: 100 },
{ text: ‘Activity’, datafield: ‘activity_name’, width: 400 },
{ text: ‘Capacity’, datafield: ‘capacity’, width: 100 }
]
});
});… but as soon as I add “sortable, true”, the grid no longer appears. The stuff above it still shows (a title) but not the grid. Is this a known bug?
Hi swisspen,
Please make sure that you have added all of the needed files and especially the jqxgrid.sort.js. Here is a sample:http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/sorting.htm?web
If you have any further questions do not hesitate to contact us.Best Wishes,
MariyajQWidgets Team
http://www.jqwidgets.comThank you so much, Mariya! I had only included the files that looked relevant to me, so it wasn’t until I included “jqxmenu.js” that my widget worked properly. Goes to show that one can’t make too many assumptions about what a widget needs.
All works perfectly now.
SPHi swisspen,
In case you miss some references in the future, you may open your Browser’s Console to see the thrown errors or warnings.
Best Wishes,
MariyajQWidgets Team
http://www.jqwidgets.comMariya, I use my console all the time, but did not for this issue because I thought I had already done everything that was necessary.
This is really a problem of being over-confident because I have years of experience. (Dumb, stupid, … I know.)
-
AuthorPosts
You must be logged in to reply to this topic.