Integrate the koGrid with the Durandal/HotTowel template

后端 未结 3 1321
青春惊慌失措
青春惊慌失措 2021-02-06 04:22

I work on an asp.net solution with the Durandal template.

I try to use the koGrid (https://github.com/Knockout-Contrib/KoGrid) which is compatible with knockout. When in

3条回答
  •  囚心锁ツ
    2021-02-06 04:51

    This should be considered a workaround only! Applies to Durandal.Core 1.2 with koGrid-2.1.1.js. If either changes to fix this behavior, I will update the post.

    Add a viewAttached() function in your viewmodel (and be sure to add it to your object literal) like so:

    function viewAttached() {
        logger.log('Home View Attached', null, 'home', true);
        $(window).trigger('resize');
        return true;
    }
    

    The viewAttached function occurs after the composition binding, and the trigger will cause the koGrid to update its width/height observables. koGrid listens for this event.

    NOTE: There are still CSS conflicts with the HotTowel template that you will need to resolve. The SPA uses a font-size of 18px on the body tag. Also the panel checkboxes should be hidden, a possible conflict with the Bootstrap CSS.

提交回复
热议问题