jQWidgets Forums

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts

  • Jwhitbread
    Participant

    Ok great,
    Thanks for opening that issue up I hope it gets resolved 🙂

    Jamie.


    Jwhitbread
    Participant

    Hi Svetoslav,

    Here is the script with example data:
    https://jsfiddle.net/gz9wejd2/1/

      const data = [{
          name: "Black Tea",
          id: 1,
          parentid: null,
          partid: 5,
          quantity: 4
        },
        {
          name: "Green Tea",
          id: 3,
          parentid: null,
          partid: 6,
          quantity: 4
        },
        {
          name: "Child Black Tea",
          id: 2,
          parentid: 5,
          partid: 2,
          quantity: 4
        },
        {
          name: "Child Black Tea",
          id: 4,
          parentid: 6,
          partid: 2,
          quantity: 4
        }
      ]

    Basically I was wondering if its possible to have both child black tea’s being unique entities, in my requirements I need them to be unique because they are linked to different parents and was wondering if its possible to distinguish between the two using “id” rather than “partid” because clicking on one currently selects both.


    Jwhitbread
    Participant

    Hi Svetoslav,

    This has worked great, I’m having one more issue now though,

    In my table I’m using this hierarchy
    hierarchy:
    {
    keyDataField: {name: ‘part_id’},
    parentDataField: {name: ‘parent_part_id’}
    },
    id: ‘unique_id’,

    and in my rows I have this:
    [
    {unique_id: 23, part_id: 5, parent_part_id: 6, quantity: 1}
    {unique_id: 37, part_id: 5, parent_part_id: 8, quantity: 1}
    ];

    When I edit quantity of one of these rows it edits both, same with selecting one it selects both. They have different parents and a unique ID to distinguish between them.
    Is it possible to make the table recognise the unique_id as a unique but maintaining the hierarchy of the key and parent?

    Thanks,
    Jamie.


    Jwhitbread
    Participant

    Hi Svetoslav,

    Thank you for the response,
    How would I apply this to a JqxTreeGrid that uses

    hierarchy:
    {
    keyDataField: {name: ‘standard_id’},
    parentDataField: {name: ‘parent_standard_id’}
    },

    In the example children are defined by them being within a multi dimensional array, where I’m defining the key data field and parent ID.
    When adding a row I’ve noticed that it uses row_id rather than if I give it the parent ID specified when I made the table?

    I ask this because I wish to know using the given method how I’d add a row along with its children if I’m using the key datafield method rather than the children method.

    Hope that makes sense,
    Thanks.
    Jamie.


    Jwhitbread
    Participant

    Hi,

    Is there any update on the adding of the child row of the TreeGrid?
    Does the child row ID parameter not work?
    Updating the bound data is something I’d rather avoid as the data is large and will take long to reload.
    In your newDataRecords method how would I go about adding the new rows into the old data then loading the source again?

    Thanks,
    Jamie.


    Jwhitbread
    Participant

    This did help,
    Thank you for your assistance.

    Jamie.


    Jwhitbread
    Participant

    Ah excellent yes that worked thank you!


    Jwhitbread
    Participant

    Hi Martin,

    Sorry for the late response I’ve returned to this and added to the JSFiddle.

    The Code

    Things to note:
    – Im running this on Edge
    – I still get a script error in the JSFiddle, and when I try to drag a row in the designer to the columns it freezes the label in the column.

    Here is what I put in the JS in case you can’t open the fiddle.

    $(document).ready(function() {
            var array = [{"user_name":"Jeff","year_week":"202205","project_code":"HOLDY","Sum_timesheet_hours":"37.50"},{"user_name":"Bob","year_week":"202202","project_code":"HOLDY","Sum_timesheet_hours":"24.75"},{"user_name":"Steve","year_week":"202206","project_code":"HOLDY","Sum_timesheet_hours":"37.50"},{"user_name":"Houdini ","year_week":"202207","project_code":"HOLDY","Sum_timesheet_hours":"16.50"},{"user_name":"Jack","year_week":"202209","project_code":"HOLDY","Sum_timesheet_hours":"16.50"},{"user_name":"Jill","year_week":"202202","project_code":"HOLDY","Sum_timesheet_hours":"8.25"},{"user_name":"Luigi","year_week":"202206","project_code":"HOLDY","Sum_timesheet_hours":"8.25"}];
            createPivotTable(array);
        });
    
        function createPivotTable(data){
            var source =
                {
                    localdata: data,
                    datatype: "array",
                    datafields:
                        [
                            { name: 'user_name', type: 'string' },
                            { name: 'year_week', type: 'number' },
                            { name: 'project_code', type: 'string' },
                            { name: 'Sum_timesheet_hours', type: 'string' }
                        ]
                };
            var dataAdapter = new $.jqx.dataAdapter(source);
            dataAdapter.dataBind();
            var pivotDataSource = new $.jqx.pivot(
                dataAdapter,
                {
                    pivotValuesOnRows: false,
                    rows: [
                        { dataField: 'user_name', width: 'auto'},
                        { dataField: 'year_week', width: 'auto'}],
                    columns: [{ dataField: 'project_code', width: 'auto'}],
                    values: [
                        { dataField: 'Sum_timesheet_hours', text: 'Hours' }
                    ]
                }
            );
            var localization = { 'var': 'Variance' };
            $('#divPivotGrid').jqxPivotGrid(
                {
                    localization: localization,
                    source: pivotDataSource,
                    treeStyleRows: false,
                    autoResize: false,
                    multipleSelectionEnabled: true
                });
            var pivotGridInstance = $('#divPivotGrid').jqxPivotGrid('getInstance');
            // create a pivot grid
            $('#divPivotGridDesigner').jqxPivotDesigner(
                {
                    type: 'pivotGrid',
                    target: pivotGridInstance
                });
        }

    Jwhitbread
    Participant

    Hi Peter,

    I’m currently running 12.2.0 and I’m having this issue.

    When I set the JqxGrid offset with the “scrolloffset” method in the API, the Scroll bar does stay in position however the contents return to the top upon data refresh. I have tried setting the method after the refresh of the grid along with the “bindingcomplete” without luck.

    Worth noting that I have also pinned the header of the grid if that could be causing an issue?

    Otherwise a possible workaround like how I would fix the browser scrool bar like so:
    $(“html, body”).animate({scrollTop: current_scroll});
    If you know which class I should try to animate in this way instead of html and body?

    Thanks,
    Jamie.


    Jwhitbread
    Participant

    Hello Peter,

    Do you have documentation of all functionality available to the cardview mode of the grid?
    I can’t find the specific properties for the cardview within JqxGrid.

    Thanks,
    Jamie.

Viewing 10 posts - 1 through 10 (of 10 total)