Counting Elements in Sahi - sahi

The search of a particular query displays the it's results in the form of a elements contained inside a div. How can I count the number of search results(elements) inside that div after the search is complete. Note : Results are inside a "div" and not a table. Hence the traditional Count used for counting rows and columns in a table cannot be applied here !

Isnt the below mentioned api working?
_count Api
You can use the api as below:
var $textboxCount = _count("_elementType", _in(_div($identifier));

Related

How to collect all the id values for a yadcf filtered table

I'm using datatables and yadcf to filter a table. Now I'd like to take all the table row id values, for example, and use those as arguments in a POST request. How can I "collect" the values of these ids from the result of the filters that have been applied? I've seen this example, which doesn't seem to apply to yadcf, but is similar to my use-case.
I was able to get the information I wanted using the answer found here. I didn't realize that jQuery will select only the visible elements, which is what I want. So, after applying the yadcf filter to my table it's simple to select all the tr.id values resulting from the filter.
Yes, the submit content is only the visible row with datatables.
If you have 5 rows and after filter 2 rows, if you click on submit button with the active filter only 2 rows will be submitted.
And if, conversely, you still wanted to submit all the elements of the table despite the filtering, on the onsubmit there is a yadcf function that you just have to execute which deactivates all active filtering to submit the entire table like this :
var table = $('#mytable').DataTable( {}) ;
document.onsubmit = function(){
yadcf.exResetAllFilters(table) ;
};

Take an Element of a List which is in a List

I know this sounds confusing. I have a List which consists of Lists in these Lists i have always 2 Elements. I want to display the first Element of all Lists. How does it work?
When you trying to display the list of elements as a group using foreach() loop. By default the list will be displayed in Ascending order only, try that approach once. If you face any issue, please provide your source code, as you trying out to display group of sublists in a Listview. Happy coding

Get Children of Parent Row

Is there any way to get all of the children of a parent row? The only method that I see, is to grab all of the rows and look at the parentId's assigned to the children.
(For what it is worth, I am using the javascript api)
I don't believe it's currently possible to explicitly request all child rows of a specified row, using the SmartSheet API.
As you've described in your post, you'd need to use the Get Sheet operation to get the list of all rows in the sheet, then look for row objects in that result set where parentId matches the id of the parent row you're interested in.

How to get list of rows of selected sheet in Smartsheet using REST?

I'm trying to get list of rows of selected sheet. I went for REST API for rows List of row's related calls but didn't get any resource to get list of rows.
How can I get list of rows? or the REST call have not been written yet.
You can get a list of rows by using the Get Sheet operation. The response will contain the list of rows in the sheet, the list of columns in the sheet (which you'll need to interpret the cells data within the rows collection), along with sheet-level properties and any other data you've requested by using the include parameter.

How can you remove or change the cakephp pagination count query on postgresql?

I am using cakephp with postgresql. Some of my tables are very large.When using cakephp's pagination, it runs COUNT() on the large table and then it queries for the actual result. The count query takes 2.5 minutes, while the actual query that returns the data takes 95ms.
Is it possible to remove the need for the count, or replace it with something that may go faster?
I don't need an exact number of rows returned, much like the way a Google search returns results 1-10 of about 765,000.
EDIT: Alternately, is there a way I can disable count altogether? There will often be so many results knowing how many pages is not necessary. All I need is a "Next" button that increases the SQL OFFSET like the cakephp pagination already has, and if no rows are returned on the next page then that is fine.
I found the way to bypass the pagination count query in cakephp.
In the model that you want to paginate you can override the function that runs the count query, the function is paginateCount($conditions = null, $recursive = 0, $extra = array())
I used the following code to fix my issue:
function paginateCount($conditions = null, $recursive = 0, $extra = array()) {
return 0;
}
Then I edited the pagination in the view to always display the next button. Going to a page with no results will just display nothing.
Official documentation gives you an ability to just force cake to fetch actual results:
http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html#custom-query-pagination
I hope it helps :-)