jQWidgets Forums

Forum Replies Created

Viewing 15 posts - 91 through 105 (of 116 total)
  • Author
    Posts
  • in reply to: Display "No Data" message? Display "No Data" message? #30927

    realtek
    Participant

    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.

    in reply to: Storing other data again item Storing other data again item #30747

    realtek
    Participant

    Sorry Dimitar,

    I meant “label and value” not “item”.

    So these are the only two custom fields we have?

    Thanks

    in reply to: Grouping on two values Grouping on two values #30602

    realtek
    Participant

    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

    in reply to: Grouping on two values Grouping on two values #30560

    realtek
    Participant

    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
    —-Person

    What 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 
    in reply to: Grouping on two values Grouping on two values #30559

    realtek
    Participant

    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_DisplayName

    However 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
    in reply to: Store more values in results Store more values in results #30492

    realtek
    Participant

    Hi 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!

    in reply to: Grid Rows with Paging Grid Rows with Paging #30343

    realtek
    Participant

    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


    realtek
    Participant

    I 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) 🙂


    realtek
    Participant

    Hi Peter,

    Thank you, I resolved this issue so its all sorted now.

    Thanks,


    realtek
    Participant

    OK Thanks Dimitar, can this be suggested for a future release? only as it may seem confusing for the user.


    realtek
    Participant

    Thank you 🙂

    in reply to: How to display scrollbar? How to display scrollbar? #29863

    realtek
    Participant

    Hi,

    I forgot to mention the Tree is actually inside a Splitter which is obviously inside a splitter panel, shouldn’t this display scrollbars?

    Thanks


    realtek
    Participant

    Anyone?

    in reply to: Rebind data from server? Rebind data from server? #29708

    realtek
    Participant

    After 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.

    in reply to: Rebind data from server? Rebind data from server? #29706

    realtek
    Participant

    OK, 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?

Viewing 15 posts - 91 through 105 (of 116 total)