-1

this is might clearer: I have billion records data for treegrid, I use plugin jqwidget treegrid using "virtual mode", but the editing proccess for update data does not work in term it doesn't send data to server. How can I fix the problem.

Or I have to change the plugin, could you give me some recomendations to find the best plugin for treegrid.

this is my code

$("#jqxTreeGrid").jqxTreeGrid({ width: '100%', icons: true, autoRowHeight: true, showHeader: true, columnsHeight: 30, columnsResize: true, columnsReorder: true, filterable: true, filterMode: 'advanced', sortable: true, pageable: false, pagerMode: 'advanced', altRows: true,
showToolbar: true, showStatusbar: true, toolbarHeight:35, editable: true,
editSettings: { saveOnPageChange: true, saveOnBlur: true, saveOnSelectionChange: true, cancelOnEsc: true, saveOnEnter: true, editSingleCell: false, editOnDoubleClick: true, editOnF2: true },
pageSizeOptions: ['5', '10', '25', '50', '100', '200', '500', '1000'], virtualModeRecordCreating: function (record) { if (record.is_leaf) { record.leaf = true; } }, virtualModeCreateRecords: function (expandedRecord, done) { var source = { dataType: "json", dataFields: [ { name: 'group_pin', type: 'string'}, { name: 'root_of', type: 'string'}, { name: 'user_pin_owner', type: 'string'}, { name: 'name', type: 'string'}, { name: 'name_alias', type: 'string'}, { name: 'url', type: 'string'}, { name: 'avatar', type: 'string'}, { name: 'type', type: 'string'}, { name: 'address', type: 'string'}, { name: 'icon', type: 'string'}, { name: 'is_leaf', type: 'bool'}, { name: 'description', type: 'string'} ], type: 'GET', cache: false, id: 'group_pin', hierarchy: { keyDataField: { name: 'group_pin' }, parentDataField: { name: 'root_of' } }, url: 'http://localhost/app/listdata', root: "listData", addRow: function (rowID, rowData, position, parentID, commit) { commit(true); newRowID = rowID; }, updateRow: function (rowid, rowdata, commit) { $.ajax({ type: "POST", url: 'http://localhost/app/save', dataType: 'json', data: $.param(rowdata), error: function (xhr, textStatus, errorThrown) { commit(false); }, success: function(data, textStatus){ if(data['response'] == true) { commit(true);

                        }
                        else
                        {
                            commit(false);
                        }   
                   }
                });
            }
        }; 
        var dataAdapter = new $.jqx.dataAdapter(source,{
            beforeSend: function (xhr) { },
            downloadComplete: function (data, status, xhr) { },
            loadComplete: function (data) { 
                done(dataAdapter.records);
                $("#clearParentGroupbuttom").addClass("disabled");
                if(data.listData.length > 0)
                {
                    for(var i=0; i<data.listData.length; i++ )
                    {
                        if(data.listData[i].root_of != '')
                        {
                            $("#jqxTreeGrid").jqxTreeGrid('expandRow', data.listData[i].root_of);
                        }
                    }
                }
            },
            beforeLoadComplete: function (records) { },
            loadError: function (xhr, textStatus, errorThrown) { 
                done(false);
            },
            formatData: function (data) {
                if (expandedRecord == null) 
                {
                    data.parent_code = ""
                }
                else 
                {
                    data.parent_code = expandedRecord.group_pin;
                }
                var pageSize = $('#jqxTreeGrid').jqxTreeGrid('pageSize');
                return data;
            }
        });
        dataAdapter.dataBind();
    },
    columns: [
        {
            text: 'Name', 
            pinned: true,
            dataField: 'group_pin',
            editable: false,
            align: 'center',
            hidden: true,
            sortable: true,
            filterable: true,
            width: 150
        },{
            text: 'Name', 
            pinned: true,
            dataField: 'name',
            align: 'center',
            minWidth: 200,
            width: 350,
            cellsRenderer: function (rowKey, column, cellValue, rowData, cellText) {
                return cellValue + " (<b style='font-size:10px;'>Pin: " + rowData["group_pin"] + "</b>)";
            },
            validation: function (cell, value) {
                if (value == "")
                {
                    return { result: false, message: "<?php echo trans('garputala.required_textbox'); ?>" };
                }                             
                return true;
            }
        },{
            text: 'Owner', 
            pinned: true,
            dataField: 'user_pin_owner',
            editable: false,
            hidden: true,
            align: 'center',
            cellsAlign: 'center',
            width: 100
        }
    ]
});

Thanks Rido

  • This seems very unclear. Can you clarify what the problem is that you're facing, perhaps show some code? – Pekka Feb 09 '16 at 11:22

1 Answers1

1

You should implement "updateRow" function in the TreeGrid's source object. There you should make AJAX call to send the updated data to your server. Below is a sample definition of "updateRow".

 updateRow: function (rowID, rowData, commit) {
                     // synchronize with the server - send update command
                     // call commit with parameter true if the synchronization with the server is successful 
                     // and with parameter false if the synchronization failed.
                     commit(true);
                 }
scripto
  • 2,297
  • 1
  • 14
  • 13