jQWidgets Forums

jQuery UI Widgets Forums Grid Grouping items with possible null field

This topic contains 4 replies, has 2 voices, and was last updated by  Dimitar 12 years, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Grouping items with possible null field #12109

    isv485
    Member

    Hi!

    I am binding to the jqxGrid some data that have ParentId field.
    ParentId can be null or some int value.

    Grid is loaded and I see ParentId field correctly, but I am not able to group grid items based on this field.

    I am expecting that problem comes from the fact that ParentId field can be null.

    Is it possible to group grid items based on such ParentId field?
    Is there a workaround for this problem?

    Thanks!

    Grouping items with possible null field #12116

    Dimitar
    Participant

    Hello isv485,

    We have tested an example with a column with null values and the columns are still groupable. Could you, please, post a code snippet so that we can determine the source of the issue. Please, make sure you are using the latest version of jQWidgets (2.5.5), too.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Grouping items with possible null field #12308

    isv485
    Member

    Hi Dimitar!

    Attached is test code that reproduces reported behavior.
    If first item in the row has group parameter that is null (undefined), jqxGrid grouping does not work correctly.

    Thanks!

    This example shows how to integrate jqxGrid using jqxDataAdapter with Knockout.js.

    $(document).ready(function () {

    function Person(data) {
    this.name = ko.observable(data.name);
    this.sales = ko.observable(data.sales);
    this.price = ko.observable(data.price);
    };

    var initialData = [
    new Person({ name: “Person 1”, sales: undefined, price: 1 }),
    new Person({ name: “Person 2”, sales: 222, price: 2}),
    new Person({ name: “Person 3”, sales: 11, price: 3 }),
    new Person({ name: “Person 4”, sales: 43, price: 4 })
    ];

    var GridModel = function (items) {
    this.items = ko.observableArray(items);
    this.disabled = ko.observable(false);

    this.addItem = function () {
    // add a new item.
    if (this.items().length < 20) {
    this.items.push( new Person({ name: "New item", sales: Math.round(Math.random() * 100), price: Math.round(Math.random() * 100) }));
    }
    };

    this.removeItem = function () {
    // remove the last item.
    this.items.pop();
    };

    this.updateItem = function () {
    // update the first item.
    var item = {};
    item.name = initialData[Math.floor(Math.random() * initialData.length)].name;
    item.sales = Math.floor(Math.random() * 500);
    item.price = Math.floor(Math.random() * 200);
    this.items.replace(this.items()[0], item);
    };
    };

    var model = new GridModel(initialData);
    var source = {
    localdata: model.items,
    datatype: 'observablearray'
    }

    var dataAdapter = new $.jqx.dataAdapter(source);
    $("#jqxGrid").jqxGrid({
    autoheight: true,
    theme: getTheme(),
    source: dataAdapter,
    editable: true,
    groupable: true,
    groups: ['Sales'],
    selectionmode: 'singlecell',
    columns: [
    { text: 'Name', dataField: 'name', width: 200 },
    { text: 'Sales', dataField: 'sales', width: 200, cellsalign: 'right' },
    { text: 'Price', dataField: 'price', width: 200, cellsalign: 'right' }
    ]
    });

    ko.applyBindings(model);
    });

    Disabled

    Grouping items with possible null field #12365

    isv485
    Member

    Hi Dimitar!

    I saw that you accepted this issue, but forum was reset and I can not see last messages. Do you have any vision on when this issue can be fixed?

    Thanks!

    Grouping items with possible null field #12426

    Dimitar
    Participant

    Hi isv485,

    The issue will be fixed in the next version of jQWidgets.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.