Open ashit44244 opened 11 years ago
Yes It would be easy to change number for something else.
https://github.com/remylab/jpaginator/blob/master/jPaginator.js
Line 162, you could replace : $(this).html(n); by $(this).html( translateNumber(n) )
where translateNumber would turn your number
Article to achieve roman conversion in JS : http://stackoverflow.com/questions/9083037/convert-a-number-into-a-roman-numeral-in-javascript
function romanize (num) { if (!+num) return false; var digits = String(+num).split(""), key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM", "","X","XX","XXX","XL","L","LX","LXX","LXXX","XC", "","I","II","III","IV","V","VI","VII","VIII","IX"], roman = "", i = 3; while (i--) roman = (key[+digits.pop() + (i * 10)] || "") + roman; return Array(+digits.join("") + 1).join("M") + roman; }
I have roman as well as Integer numbers , something like this.[ i , ii ,iii, iv, v ,vi ,vii, 1,2,3,4,5,6,7]. Basicallly i could be any String(mix of Integer as well as String). Changing only in line 162 wont help i guess. Because s.selected page
is used at places like init() method for calculations. So suppose you click on a Roman Number "vi" , then s.selected= "vi". So it will throw NaN exception.
Ok so I guess the only solution is you refactor the plugin to use a number object anywhere it uses a pagination number. The number object would look something like {"n":7,"s":"vii"}. But having a mix a integer/string would prevent you to specify the number of pages and instead use an array of number objects to initialize it, which is not supported.
I have done some poc and made it working for mix of both .No of pages i have taken as length of array containing the pages. in the init method i added a check if the array contains mix bag then s.selected will be the position where the particular no is present be it integer/String. Suppose [ i ii iii iv v vi 1 2 3 4 5 6 7] is the displayed no. Here for "vi" it will find at what position is "vi" in the array. Everthing is working fine except when i hover over forward or backward buttons the highlighted page blinks and sometimes get dehighlighted. In the updateNum() method there is a lot of recursive call which is creating this issue,not able to figure out
Hi Can we use jpaginator for values other than number.Can you give some help on it. I am using jpaginator for numeric no only, but now i see the Roman numbers are also there. Thanks in Advance