jQuery UI Widgets Forums TreeGrid Treegrid prevent sort on column renderer

This topic contains 3 replies, has 2 voices, and was last updated by  Hristo 4 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • dan123
    Participant

    Hi I am trying to add a input field on the jqxtreegrid column header using the renderer property. But for some reason whenever i click the input field it is also calling the sort event. So I do in prevent that sort event from happening? I would appreciate a workaround if possible thanks

    Here is my example:
    https://jseditor.io/?key=838abdd53e7411ea878200224d6bfcd5

    Treegrid prevent sort on column renderer #107936

    Hristo
    Participant

    Hello dan123,

    There is no built-in feature for this.
    But if you want you could try to prevent sorting or just to miss it.
    For example, you could try to use the approach from this topic.
    It used a boolean flag and if this is not the desired case it removes the sorting.
    In your case, you could try to remove the sorting on each clicking on the input.
    Because by default they are in the header of the columns and clicking on the header invoke native sorting behavior.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    dan123
    Participant

    Hi Hristo

    Any other way i can add the custom filter row besides adding as a renderer? because i tried to do the approach with remove sort on click of input but that doesn’t work as expected. Other case is that lets say i clicked on the a column sort and i then clicked a filter input box, this would remove my current sort. Which that way would not work either. The sort and filter should work independently of each other.

    I thought of adding as a toolbar, but then that doesn’t function like a column.

    Is there anything we can do with this javascript mention ‘event.stopPropagation();’ maybe on the sort event from being triggered if clicked on the filter input box?

    Here is my jsfiddle:
    https://jseditor.io/?key=79a9c0b98a2911ea98fa00224d6bfcd5

    This filter row feature for the jqxtreegrid has been highly requested feature. I really hope jqwidgets team implements this soon.


    Hristo
    Participant

    Hello dan123,

    The sorting and filtering work independently.
    But the final result (the visualized records) is affected by both of them.
    I would like to mention that the binding to an event into another one is not appropriate because it could bind many times.
    The all these settings are customizations but I would like to suggest you to try this approach, too:

    $(".jqx-grid-column-header input").click(_ => {
    	setTimeout(_ => {
    		$("#treeGrid").jqxTreeGrid("sortBy", null);
    	}, 0);
    });

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com

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

You must be logged in to reply to this topic.