datatables read language option from cookie -
i'm using angular-datatables(based on jquery-datatables), reading language json files. it's not hard switch datatables language through $scope.dtoptions.language.url = '../locales/dt/'+ lng +'.json';
once page refreshes, go default language. there way save language.url in cookie, , tell datatables read language option cookie?
you better use localstorage that. has 2 benefits - 1) size not limited 4kb, starts 5mb; 2) not being sent on wire server , every request. more on comparison here local storage vs cookies browser api straightforward:
localstorage.setitem('datatableslang', 'en'); localstorage.getitem('datatableslang'); // =='en'
more details on browser api here: https://developer.mozilla.org/en-us/docs/web/api/storage/localstorage
besides there's angular module: angular-local-storage can more.
Comments
Post a Comment