Giter Club home page Giter Club logo

Comments (6)

Et3rnal avatar Et3rnal commented on August 27, 2024 3

Here is what I did if you need more specific logic it should be easy to create:

@HostListener('body:click', ['$event'])
onMouseclick(event: any) {    

  if( (event.target && event.target.attributes.class && event.target.attributes['class'].value=="ng2-smart-page-link page-link")
  || (event.target.parentElement && event.target.parentElement.attributes['class'] && event.target.parentElement.attributes['class'].nodeValue.indexOf("ng2-smart-page-link page-link") >= 0) ){
    
    //Do something
    alert("Pager clicked");
    
  }
}

Since there is no event, we are listening to all clicks! and pick the one we want using the class where the user clicked. yes it is not the best way.

from ng2-smart-table.

minhtam-nguyennhat avatar minhtam-nguyennhat commented on August 27, 2024 2

hi, you could use the particular observable property in the data source to determine if page change occurs.

let data: LocalDataSource = new LocalDataSource();

this.data.onChanged().subscribe(change => {
	switch (change.action) {
		case 'page':
			this.handleSmartTablePageChange(change);
			break;
		case 'sort':
			this.handleSmartTableSort(change);
			break;
	}
});

Best regards

from ng2-smart-table.

Sravanti94 avatar Sravanti94 commented on August 27, 2024 1

hey @vladoros have you got any solution on this.

from ng2-smart-table.

AkhilNaidu09 avatar AkhilNaidu09 commented on August 27, 2024 1

@Et3rnal good one. But pagination steps are populated on basis of source length, If we create server side pagination your solution wont work. To capture click event it was a good idea 👍

from ng2-smart-table.

AtifJaved1 avatar AtifJaved1 commented on August 27, 2024

@vladoros, you can use the Angular Material Tables instead of this. as I have faced the same issue and didnt found any other solution

from ng2-smart-table.

Et3rnal avatar Et3rnal commented on August 27, 2024

I'm facing the same here, any solution to attach event anyone?

from ng2-smart-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.