How do we add a text in React table pagination component? - reactjs

basically i need to add another text at the end . ie. , Page 1 of 2 recordds
I tried this property nextText={"nextpage"}, but does not work,Thoughts ?

You can use ofText prop
ofText= 'of records'
Which will give you ouput like,
Page 1 of records 2

Related

How to grab a element on my current tab , which is repeating itself on every tab of my angular page using protractor

For example a table is repeating itself on all the 3 tabs of the page with following element.
[ng-repeat="(key, r) in $data track by key"]
How do i grab the rows of the table on a specific tab.
Using the regular element(by.repeater) .. returns results from all the tabs
You could wrap each tab with an ID and select it via
element(<locator of active tab>)
// find the active tab firstly to tell the next element(by) in the chain:
// 'your find context is the active tab'
.element(by.repeater(...))

How to retrieve the page number we are currently on, while using an antd table

I have created a table with the Antd in Reactjs. I have used 50 rows per page and I have around 6 pages that come up in the pagination.
I have added an index column to the table, which loops from 1 to 50 on every page.
Rather I need it to loop from 1 to full length. So when I navigate to page 2, It must show 51 to 100, whereas in my case it loops from 1 to 50 again. I made use of "index",that is passed from the "render" function in the table.
function indexRenderer(text, record, index) {
return index+1
}
Is there any seperate function I can use to retrieve the page count alone from the pagination of antd.
You can use onChange function of Pagination component.
It will be called with page parameter.
Check this out for more information:
https://ant.design/components/pagination/

Set focus on autocomplete field

I have a form that has some fields.
One field is autocomplete
.
The field is filled with information from a table
$f->addField('autocomplete','idfield','Field')->setValueList( $this->api->db->dsql()
->table('items')->field('id,name')->do_getAssoc() );
I'm trying to set the focus on that field when the page loads.
I have did this
On top of the page
$p->js()->_load('seteo_foco');
And then
seteo_foco.js
$(function(){
$("select:first").focus();
})
But this does not work.
Anybody can help ?
Thanks
Try TRUE like
$this->js(true)->_load('seteo_foco'); to load js file.
But in your js code your selector is incorrect. You need to specify you unique field. I'd use something like $form->getElement('field_name')->js(true)->focus(); on the page after the form has been initialized.

Cakephp Pagination URL

I am facing a problem in cake php pagination. In my project I have Category Suppose 'Wooden' , In this I have Sub Category as 'Wooden Tables' and further 'Wooden tables' has many products. In sub category i am doing pagination . I am showing 10 items per page. Now the problem is that When i click on any of the pagination link , its missing sub category number. for example : the URL should look like this : http://amazingtech.in/lariya/products/index/4/page:2 but when i click on pagination link the URL look like this http://amazingtech.in/lariya/products/index/page:2 . It is missing the sub category number 4 , which leads to page not found error. and when i manually enter the URL Like this . It works.
I don't know how to modify pagination URL. Thanks in advance.
Pagination - that is selecting or sorting results - isn't the same as searching for them by criteria, even though Cake supports passing them as an array or named params. That is to say, conditions of your find() are not preserved in the same way as your pagination params.
So You'd need to include your condition as a named or query parameter: eg: assuming your category is 'category' (it might be category_id, replace as needed)
http://amazingtech.in/lariya/products/index/category:1234/page:2
Or possibly:
http://amazingtech.in/lariya/products/index/category:Wooden/page:2 //more SEO friendly
Or even:
http://amazingtech.in/lariya/products/index/4/page:2
http://amazingtech.in/lariya/products/index/Wooden/page:2 //more SEO friendly
To do it this last way you'll need to setup your controller to look for the first URL param in and assign it as a condition of your find() operation:
public function index($category = null) {
$conditions = array('Products.category_id' => $category);
...etc
}
MORE: CakePHP Cookbook Parameters
That way, when you paginate - as long as you're going through the same controller - can preserve that category.

how to set pagingtoolbar input item value

I have a problem here.
I bind a store on the pagingtoolbar which has more than one page. For example I change current page to the page 2, then I change the store content which has only one page by a search form . The grid loads the collect data, but the input item still shows that it's in page 2, where I want it to show 1 after I call the search event.
I don't want to use store.loadPage(1) because this will cause one more exchange between the server, can anyone helps me?
Try this:
grid.store.currentPage = 1;
grid.down('pagingtoolbar').onLoad();

Resources