jQWidgets Forums
Forum Replies Created
-
Author
-
October 17, 2013 at 11:51 am in reply to: Display "No Data" message? Display "No Data" message? #30927
Thanks Peter,
In my Grid it seems I get a blank ’empty’ row which is why i’m not getting the “No Data” message displayed.
Here is my code:
var source = { datatype: 'json', url: url, id: "SEQUENCE", root: 'rowsinfo', cache: false, columns:[], datafields:[], beforeprocessing: function (data) { var columnsdata = new Array(); var datafieldsdata = new Array(); for (k in data.columnsinfo){ var col={}; col.text = data.columnsinfo[k]["DISPLAYNAME"]; col.datafield = data.columnsinfo[k]["DISPLAYNAME"]; var datafields={}; datafields.name = data.columnsinfo[k]["DISPLAYNAME"]; columnsdata .push(col); datafieldsdata .push(datafields); source.columns = columnsdata; source.datafields = datafieldsdata; } $("#jqxgrid").jqxGrid({columns : source.columns}); }, data: { group: selectedGroup, staff: selectedStaff, MODULE: selectedModuleSEQ } };
Any idea’s? I don’t think the JSON is returning an empty record as I disabled it temporarily.
October 15, 2013 at 10:52 am in reply to: Storing other data again item Storing other data again item #30747Sorry Dimitar,
I meant “label and value” not “item”.
So these are the only two custom fields we have?
Thanks
That is excellent, thank you so much Dimitar!
I have re-written my SQL Statement into a stored procedure which outputs the correct format from a table variable which is turned into JSON by the PHP.
The code works excellently and has resolved by issue.
Is this a defect in the getGroupedRecords that null values stop the tree from loading?
Thanks again
Thinking about it, the same issue would occour if you wanted the following structure with a “People” table:
-Country
–City
—Address
—-Person
—Address
—-Person
-Country
–City
—Address
—-Person
—Address
—-PersonWhat if you had a record where there was no address for a homeless person for example? the value you would NULL and you would get the same issue – the TreeView fails to display and you get this error:
Uncaught TypeError: Cannot read property 'element' of undefined
Hi Dimitar,
OK, my code is below… but the database structure probably won’t make sense to you, so I will try to explain.
I basically have several rows in the database that contain bits of information, I want it to show the following structure in the treeview based on my columns:
-View_Name
–View_DisplayName
–FK_TABLE
–View_DisplayName
–View_DisplayName
-View_Name
–View_DisplayName
–FK_TABLE
–View_DisplayName
–View_DisplayNameHowever some of the rows have NULL in the database for FK_TABLE, therefore I don’t want them to try grouping on the second grouping field because it is not valid for that type of record.
I hope this all makes sense! If you need me to re-write the SQL to be a more clearer example then let me know and I will think of another scenario that may make sense.
json:
<?php$conn = mssql_connect("test","test","test");mssql_select_db("mydatabase",$conn);$sth = mssql_query("SELECT b.Sequence as Field_Sequence, b.SEQ_Table as Table_Sequence, a.TABLENAME as Table_Name, a.VIEWNAME as View_Name, b.Display_Name as View_Display_Name, b.Column_Name as Table_Column_Name, b.DATA_TYPE as Data_Type, b.COLUMN_TYPE as Column_Type, b.FK_TABLE as FK_TABLE FROM SD_TABLES a left join SD_FIELDS b on a.Sequence = b.SEQ_TABLE");$rows = array();while($r = mssql_fetch_assoc($sth)) { $rows[] = $r;}print json_encode($rows);?>
Treeview:
function loadTree() {$.ajax({ url: 'json/dba/dba_treeview.php', type: 'POST', dataType: "json", data: { name: 'View_Name', name: 'View_Display_Name', name: 'Table_Sequence', name: 'FK_TABLE' }, success: function (data) { //Tree var dataAdapter; var records; dataAdapter = new $.jqx.dataAdapter(data); dataAdapter.dataBind(); records = dataAdapter.getGroupedRecords(['View_Name', 'FK_TABLE'], 'items', 'label', [{ name: 'Table_Sequence', map: 'value'}, {name: 'View_Display_Name', map: 'label'}], 'row', 'value'); $('#DBATree').jqxTree({allowDrag: false, allowDrop: false, source: records, height: '100%', width: '99%', theme: theme }) var treeItems = $('#DBATree').jqxTree('getItems'); var firstItem = treeItems[0]; var firstItemElement = firstItem.element; $('#DBATree').jqxTree('selectItem', $("#DBATree").find('li:first')[0]); }}); } //End Load Tree Function
October 9, 2013 at 9:06 am in reply to: Store more values in results Store more values in results #30492Hi Dimitar,
Apologies for this, you are correct. I actually had a ListBox inside it which I was binding to JSON so my mistake!
Can what i’m asking be done on a listbox? Can you retrive different data from JSON and store in your own attributes?
Thanks!
Thanks Peter,
It would be good if there was an “auto” option for this, where it worked out how many it could display on a page depending on the height.
I guess for now I will try to implement it manually by determining how many rows I could fit on the page by calculating the height of the splitter its in.
Thanks
October 4, 2013 at 2:55 pm in reply to: autoloadstate: true and server side filtering autoloadstate: true and server side filtering #30244I think you will find the time in the US are 5 hours behind you (i.e they are not working yet from when you posted your question)
October 3, 2013 at 8:29 am in reply to: Cannot get contextMenu working on a Tree Cannot get contextMenu working on a Tree #30116Hi Peter,
Thank you, I resolved this issue so its all sorted now.
Thanks,
October 1, 2013 at 2:41 pm in reply to: Change arrow cursor when Drag and Drop enabled? Change arrow cursor when Drag and Drop enabled? #29978OK Thanks Dimitar, can this be suggested for a future release? only as it may seem confusing for the user.
October 1, 2013 at 9:17 am in reply to: Display menu on tree when using data source? Display menu on tree when using data source? #29947Thank you
September 30, 2013 at 8:18 pm in reply to: How to display scrollbar? How to display scrollbar? #29863Hi,
I forgot to mention the Tree is actually inside a Splitter which is obviously inside a splitter panel, shouldn’t this display scrollbars?
Thanks
September 30, 2013 at 8:13 pm in reply to: Change arrow cursor when Drag and Drop enabled? Change arrow cursor when Drag and Drop enabled? #29862Anyone?
September 27, 2013 at 12:07 pm in reply to: Rebind data from server? Rebind data from server? #29708After adding some more data in my source, I can confirm you get the rows in the Grid each time you reset the source but it does not set the cells.
September 27, 2013 at 11:45 am in reply to: Rebind data from server? Rebind data from server? #29706OK, sorted.
I’m not sure if it is a bug or the way my code is but if the data that is provided when the grid is first loaded on the page is empty (i.e returns no rows), and you then reset the source it does NOT populate the grid.
However, if the initial set of data returned does provide some rows and you then change the source, it works.
So it sounds like its because no cells are actually created in the Grid if nothing is returned, therefore it cannot render it correctly.
Is this a bug?
-
AuthorPosts