datatable ajax search,javascript - Jquery Datatable search - Stack Overflow

Dynamic search a datatable using jquery

consider you have a datatable as shown below and you want to filter London

var table=$('#example').DataTable();

table.search( 'London' ).draw();

Datatable:

$(document).ready(function() {

var table=$('#example').DataTable();

var name ='London';

table.search(name).draw();

} );

NamePositionOfficeAgeStart dateSalary

Merrin ChandlerSales AssistantSan Francisco592012/08/06$137,500Derrin Davidson SpecialistTokyo552010/10/14$327,900Jeffrin HurstJavascript DeveloperSan Francisco392009/09/15$205,500Sonya FrostSoftware EngineerEdinburgh232008/12/13$103,600Jena GainesOffice ManagerLondon302008/12/19$90,560Quinn FlynnSupport LeadEdinburgh222013/03/03$342,000Charde MarshallRegional DirectorSan Francisco362008/10/16$470,600Haley KennedySenior Marketing DesignerLondon432012/12/18$313,500Tatyana FitzpatrickRegional DirectorLondon192010/03/17$385,750Michael SilvaMarketing DesignerLondon662012/11/27$198,500Paul ByrdChief Financial Officer (CFO)New York642010/06/09$725,000Gloria LittleSystems AdministratorNew York592009/04/10$237,500Bradley GreerSoftware EngineerLondon412012/10/13$132,000Dai RiosPersonnel LeadEdinburgh352012/09/26$217,500Jenette CaldwellDevelopment LeadNew York302011/09/03$345,000Yuri BerryChief Marketing Officer (CMO)New York402009/06/25$675,000Caesar VancePre-Sales SupportNew York212011/12/12$106,450Doris WilderSales AssistantSydney232010/09/20$85,600Angelica RamosChief Executive Officer (CEO)London472009/10/09$1,200,000Gavin JoyceDeveloperEdinburgh422010/12/22$92,575Jennifer ChangRegional DirectorSingapore282010/11/14$357,650Brenden WagnerSoftware EngineerSan Francisco282011/06/07$206,850Fiona GreenChief Operating Officer (COO)San Francisco482010/03/11$850,000Shou ItouRegional MarketingTokyo202011/08/14$163,000Michelle HouseIntegration SpecialistSydney372011/06/02$95,400Suki BurksDeveloperLondon532009/10/22$114,500Prescott BartlettTechnical AuthorLondon272011/05/07$145,000Gavin CortezTeam LeaderSan Francisco222008/10/26$235,500Martena MccrayPost-Sales supportEdinburgh462011/03/09$324,050Unity ButlerMarketing DesignerSan Francisco472009/12/09$85,675Howard HatfieldOffice ManagerSan Francisco512008/12/16$164,500Hope FuentesSecretarySan Francisco412010/02/12$109,850Vivian HarrellFinancial ControllerSan Francisco622009/02/14$452,500Timothy MooneyOffice ManagerLondon372008/12/11$136,200Jackson BradshawDirectorNew York652008/09/26$645,750Thor WaltonDeveloperNew York612013/08/11$98,540Finn CamachoSupport EngineerSan Francisco472009/07/07$87,500Serge BaldwinData CoordinatorSingapore642012/04/09$138,575Zenaida FrankSoftware EngineerNew York632010/01/04$125,250Zorita SerranoSoftware EngineerSan Francisco562012/06/01$115,000Jennifer AcostaJunior Javascript DeveloperEdinburgh432013/02/01$75,650Cara StevensSales AssistantNew York462011/12/06$145,600Hermione ButlerRegional DirectorLondon472011/03/21$356,250Lael GreerSystems AdministratorLondon212009/02/27$103,500Jonas AlexanderDeveloperSan Francisco302010/07/14$86,500Shad DeckerRegional DirectorEdinburgh512008/11/13$183,000Michael BruceJavascript DeveloperSingapore292011/06/27$183,000Donna SniderCustomer SupportNew York272011/01/25$112,000NamePositionOfficeAgeStart dateSalary
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值