1

Hi Im using jquery inside angular 4 typescript . I tried with below two events to make table header fixed. But its not working.

 ngOnInit(): void {
    $(document).ready(function() {
        $("#table").tableHeadFixer({"head" : false, "left" : 1}); 
    });

}

 ngAfterViewInit() {
    $(document).ready(function() {
        $("#table").tableHeadFixer({"head" : false, "left" : 1}); 
    });
 }

After rendered table, if i go to browser console execute below command

$("#table").tableHeadFixer({"head" : false, "left" : 1});

table header is get freezes now.

Please help on this.

8
  • First of all ?why are you using jquery. Never do it. what is that you are trying to do? Commented May 11, 2017 at 13:42
  • I want to make header and first row to be fixed. Is there any option to achieve this functionality? Commented May 11, 2017 at 13:45
  • what is the grid you are using ? Commented May 11, 2017 at 13:45
  • I'm using simple html table Commented May 11, 2017 at 13:46
  • because you call it several times Commented May 11, 2017 at 13:52

1 Answer 1

1

Don't use jquery inside angular like that. If you need a good table library there are plenty of good choices designed for angular2-4:

ngx-datatable - https://swimlane.github.io/ngx-datatable/
ng2-table - https://github.com/valor-software/ng2-table
wijmo - http://wijmo.com/angular2/
ag-Grid - https://www.ag-grid.com/
Sign up to request clarification or add additional context in comments.

1 Comment

this must be a comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.