tonytomov / jqGrid

jQuery grid plugin
www.trirand.com
2.84k stars 1.2k forks source link

Custom `pgtext` always show an input type text, config to show only text #1004

Closed fredsal closed 2 years ago

fredsal commented 2 years ago

is there a config to show pages just like recordtext, where you can put Page {} of {}, and it will show Page 1 of 5 only as text?, is there any way to achieve that?

if it doesn't exist, it could be a feature, actually if you put Page {0} of {1} on pgtext it shows an input Page <input class="ui-pg-input form-control" type="text" size="2" maxlength="7" value="1" role="textbox"> of 5

Actual behaivor image New behaivor? image

On recordtext image


I propose change the line https://github.com/tonytomov/jqGrid/blob/863aa5d0883b1a4d27f69af0189f4c2f89c24557/js/grid.base.js#L3363 To

$('.ui-pg-input',pgboxes).val(ts.p.page).html(ts.p.page);
// Or 
$('.ui-pg-input',pgboxes)[$('.ui-pg-input',pgboxes).first().is(':input')?'val':'html'](ts.p.page);

Now it works using

{
     pgtext : "Page <span class='ui-pg-input'></span> of {1}",
}

Other way(longer) Creating {2} with "sp_2_"+pgid

please, let me know if i have to do a PR for this

tonytomov commented 2 years ago

Hello,

Thank you for the recommendation. I will look deeper in pager functions and will let you know what we can do.

tonytomov commented 2 years ago

I have added this new feature. Please let me know if it is ok.

Best Regards, Tony

fredsal commented 2 years ago

It seems to be working now,

Thank you very much