grid.setOptions broke columns editor

8 posts, 1 answers
  1. Kudryk
    Kudryk avatar
    17 posts
    Member since:
    Dec 2014

    Posted 02 Jun 2015 Link to this post

    I've set columns editor for the column "itpt_name" but after grid.setOptions it is broken

    Here is the example http://dojo.telerik.com/EjIlI

    You need to follow these steps to reproduse

    1) Open http://dojo.telerik.com/EjIlI

    2) Click "Run"

    3) Double click in any Cell in column "Партия" (you can see working custom editor with the broken images, it is normal)

    4) Set sorting for the column "Партия"

    5) Save state using "Save state" button

    6) Ctrl+F5

    7) Load saved state

    8) Double click in any Cell in column "Партия" (custom editor is broken, it is not normal)

     Please advise why custom editor is broken

  2. Kudryk
    Kudryk avatar
    17 posts
    Member since:
    Dec 2014

    Posted 03 Jun 2015 in reply to Kudryk Link to this post

    Here is an example from the Kendo API refference. It doesn`t work also

    http://dojo.telerik.com/UsAGi

  3. Answer
    Dimo
    Admin
    Dimo avatar
    8401 posts

    Posted 04 Jun 2015 Link to this post

    Hi Kudryk,

    Please read the first bullet from big yellow note in the setOptions() documentation and let me know if you have additional questions.

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-setOptions

    Regards,
    Dimo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  4. Kudryk
    Kudryk avatar
    17 posts
    Member since:
    Dec 2014

    Posted 05 Jun 2015 in reply to Dimo Link to this post

    Thank you. I've tried to set editors for the grid columns with restored settings, that was my error.

    Here is the working example for others who have the same problem

    http://dojo.telerik.com/IBOho

  5. Bill
    Bill avatar
    31 posts
    Member since:
    Mar 2013

    Posted 28 Jan 2016 in reply to Kudryk Link to this post

    This should be a feature request.  Where can I suggest and vote on this?

    getOptions and setOptions should include ALL templates.  I've just turned gray figuring this out and having to set all my view, editor and filterable cell templates.

  6. Dimo
    Admin
    Dimo avatar
    8401 posts

    Posted 29 Jan 2016 Link to this post

    Hi Bill,

    I am sorry about your negative experience. You can submit your suggestions at

    http://kendoui-feedback.telerik.com/

    Regards,
    Dimo
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Frédéric.R
    Frédéric.R avatar
    5 posts
    Member since:
    Feb 2015

    Posted 22 May Link to this post

    This code is still working for me.
    (merged from different solutions seen in the past) :

    function saveGridPersistState(grid) {
        if (grid) {
            var dataSource = grid.dataSource;

            var state = {
                aggregate: dataSource.aggregate(),
                filter: dataSource.filter(),
                group: dataSource.group(),
                page: dataSource.page(),
                pageSize: dataSource.pageSize(),
                sort: dataSource.sort()
            };

            $.sessionStorage.set("GridState" + "-" + grid.element.attr('id'), state);

            if (grid.options.persistSelection)
                $.sessionStorage.set("GridSelected" + "-" + grid.element.attr('id'), grid._selectedIds);
        }
    }



    function loadGridPersistState(grid) {
        if (grid) {
            var state = $.sessionStorage.get("GridState" + "-" + grid.element.attr('id'));

            if (state) {
                if (state.filter) {
                    parseFilterDates(state.filter, grid.dataSource.options.schema.model.fields);
                }
                grid.dataSource.query(state);
                ClearFilterContainer(grid);

                var selected = $.sessionStorage.get("GridSelected" + "-" + grid.element.attr('id'));
                if (grid.options.persistSelection && selected)
                    grid._selectedIds = selected;

            }
        }
    }



    function parseFilterDates(filter, fields) {
        if (filter.filters) {
            for (var i = 0; i < filter.filters.length; i++) {
                parseFilterDates(filter.filters[i], fields);
            }
        }
        else {
            if (fields[filter.field].type === "date") {
                filter.value = kendo.parseDate(filter.value);
            }
        }
    }

    function ClearFilterContainer(grid) {
        var $grid = grid;

        $grid.thead.find('th').each(function () {
            var cell = $(this);

            var multiCheckNS = '.kendoFilterMultiCheck';

            var filterMenu = cell.data('kendoFilterMultiCheck');

            if (filterMenu) {

                var that = filterMenu;

                    if (that.checkSource.options.transport) {
                        that.checkSource.options.transport.read.cache = false;

                        that.checkSource = kendo.data.DataSource.create(that.options.checkSource);
                        that.checkSource.options.forceUnique = false;

                        if (that.checkSource.options.transport)
                            that.checkSource.options.transport.read.cache = false;

                        if (that.popup) {
                            that.popup.destroy();
                            that.popup = null;
                        }

                        if (that.container) {
                            that.container.unbind(multiCheckNS);
                            that.container.empty();
                        }
                    }
            }
        });
    }

     

    $(function () {

        $.alwaysUseJsonInStorage(true);     

    });

  8. Frédéric.R
    Frédéric.R avatar
    5 posts
    Member since:
    Feb 2015

    Posted 23 May Link to this post

    Open : 

    http://dojo.telerik.com/@frederic.r/ORaKE/10

Back to Top