I did a some Google about kendoui column search and feel no exact answer for me so i am posting it here. Please help or guide me where i can find my requirement.
I am going to integrate Kendoui Grid to load huge amount of data from my database, with that I wants to have single as well multi column search functionality in the grid.
My requirement us when a user key in their search value then the grid should filter the value using single column as well multi column search like the below image
I wants to implement the same search in kendo ui.
I know kendoui has filter functionality but, I exactly wants the functionality like the below.
Thanks in advance
You can use the filter method of the grid's data source to perform filtering. Something like this:
grid.dataSource.filter( {
// display items that meet any of the conditions
logic: "or",
// filter conditions
filters: [
{ field: "CompanyName", operator: "contains", value: "searchstring" },
{ field: "Country", operator: "contains", value: "searchstring" }
]
});
Related
I'm working with google forms and google sheets. I'm trying to create a summary sheet that will automatically update as the form is being filled.
I've been able to pull the data from the other sheets using a FILTER function. Now I want to add a column that shows the name of a country to the filtered column. I tried using concatenate but it didn't work as well as I'd hoped. Can someone help me figure out how to solve this problem.
Please see here for an example of the problem.
Well this is a very inelegant brute force way, but I think it works. See Solution-GK in your sheet.
=QUERY({
{TRANSPOSE(SPLIT(REPT("Nigeria~",ROWS(UNIQUE(FILTER(NIGERIA!A:E,NIGERIA!C:C<TODAY(),NIGERIA!B:B="Charity Fundraiser")))),"~")),
UNIQUE(FILTER(NIGERIA!A:E,NIGERIA!C:C<TODAY(),NIGERIA!B:B="Charity Fundraiser"))};
{TRANSPOSE(SPLIT(REPT("Sierra Leone~",ROWS(UNIQUE(FILTER('SIERRA LEONE'!A:E,'SIERRA LEONE'!C:C<TODAY(),'SIERRA LEONE'!B:B="Charity Fundraiser")))),"~")),
UNIQUE(FILTER('SIERRA LEONE'!A:E,'SIERRA LEONE'!C:C<TODAY(),'SIERRA LEONE'!B:B="Charity Fundraiser"))}},
"select Col1,Col2,Col3,Col4, Col5 where Col2 is not null")
I've added a hard coded literal of the country name, repeated it the number of times needed for the matching data rows, and made it into the first column in your existing data array. I repeat this for the second array you have for the second country.
I'm sure there are far more elegant ways to do this, so we'll see what else is proposed. If you had a list somewhere in your sheet of your country names - ie. Nigeria and Sierra Leone, possibly many more - I'm sure an elegant solution would cycle through those names, pulling the name to build the concatenated data ranges, and also adding the name as the text for each row.
Without needing a list in the sheet, a little bit of code could find all of your tab names, and exclude the non data ones, eg. Solution Here and Summary, and process all of the rest as data.
Note: I'm not clear that you need your UNIQUE statements, unless you are expecting duplicates for some reason. Also, the outer QUERY doesn't seem to be necessary - the inner FILTERs seem to do everything you need.
You could do this with an Apps Script Custom Function.
First, open a bound script by selecting Tools > Script editor, and copy the following functions to the script (check inline comments for more details about the code):
// Copyright 2020 Google LLC.
// SPDX-License-Identifier: Apache-2.0
function SUMMARIZE_FUNDRAISING_EVENTS(sheetNames, ...ranges) {
const ss = SpreadsheetApp.getActiveSpreadsheet();
sheetNames = sheetNames.split(","); // Comma-separated string to array of sheet names
const filteredData = sheetNames.map(sheetName => { // Iterate through each sheet name
const sheet = ss.getSheetByName(sheetName);
if (sheet) { // Check if sheet exists with this name
const sheetData = sheet.getRange(2,1,sheet.getLastRow()-1,4).getValues(); // Source sheet data
const filteredData = sheetData.filter(rowData => {
return rowData[1] === "Charity Fundraiser" && rowData[2] < new Date()
}); // Filter data according to date and type of event
filteredData.forEach(filteredRow => filteredRow.unshift(sheetName)); // Add sheet name to filtered data
return filteredData;
}
}).flat();
return filteredData;
}
Once it is defined, you can use the function SUMMARIZE_FUNDRAISING_EVENTS the same you would any sheets built-in function. This function would accept a series of parameters:
A comma-separated string with the names of the sheets whose data should be summarized (don't add blank spaces after the comma or similar).
The different source ranges (in your case, NIGERIA!A:E and 'SIERRA LEONE'!A:E).
Both of these are necessary, because, on the one side, specifying the source ranges as parameters makes sure that the function executes and updates the summarized data every time the source ranges are edited, and on the other side, when passed as parameters, these source ranges don't contain information about the sheet names, which the script will need when returning the summarized data.
Example of calling the function:
Reference:
Custom Functions in Google Sheets
I've found a lot of good information about the angular-ui-grid cell filters but I can't seem to locate an answer to my specific issue. Basically I have a grid set up with two columns:
Column A is a editable cell dropdown where you can pick two options, 'money' or 'percentage'. Column B is a number input displaying a value.
I have two filters in my app, 'currency' and 'percentage'. If I set up the columnDefs for either of those filters, then Column B will display all the values in that column as either a currency value or percentage.
What I need it to do though is to make it so that the filter is applied to Column B based on the setting of Column A, so I end up with this:
Value Type Value
---------------------------------------
Money $100.00
Percentage 100%
I've got some code to basically check that after the edit:
$scope.gridApi.edit.on.afterCellEdit($scope, function(rowData) {
var row = _.indexOf($scope.items, rowData);
if (rowData['valueType'] == 'percentage') {
// Apply percentage filter to the value cell for this row
} else {
// Apply currency filter to the value cell for this row
}
$scope.gridApi.core.refresh();
});
...I'm just not sure how to apply the filter to the individual cells. Any guidance would be appreciated!
If anyone else ever has the same question, I managed this by creating a filter that took the row entity as an argument, then applied the custom filters inside of that new filter based on the entity values.
I am attempting to create a dashboard - for which one of the tabs will aim to filter a list of people based on multiple criteria. For the "front cover" part of this i thought representing the criteria through checkboxes would be helpful, but have not had any inspiration on how i could make this pull in from a raw data tab with different formulas. An example of how i envisage this would look is here (example cover and raw data):
https://docs.google.com/spreadsheets/d/1RzQ5vJYwpqDClqcPe_U7meRdtFBYL_Gn6b8_yKIP1RU/edit#gid=0
The main issue i'm having is that it covers multiple criteria and i'm struggling to come up with a formula to return data with that. So, in the example sheet, i could check "apples" and "mushrooms" and it would return the peoples names from the raw data tab who satisfy this criteria.
I have used google sheets formula and the query function within sheets but am mainly finding it difficult to see how this would be possible.
If anybody had a solution to this, or a similar way they think would achieve the same goal, any help would be much appreciated!
Thanks,
Sam
I've updated your spreadsheet, with the formula in Data!F2
=IFERROR(FILTER(A2:D9,
IF(Front!$C2 = TRUE, SEARCH(Front!$B2, $B$2:$B$9), LEN($A$2:$A$9)),
IF(Front!$C3 = TRUE, SEARCH(Front!$B3, $B$2:$B$9), LEN($A$2:$A$9)),
IF(Front!$C4 = TRUE, SEARCH(Front!$B4, $B$2:$B$9), LEN($A$2:$A$9)),
IF(Front!$C6 = TRUE, SEARCH(Front!$B6, $C$2:$C$9), LEN($A$2:$A$9)),
IF(Front!$C7 = TRUE, SEARCH(Front!$B7, $C$2:$C$9), LEN($A$2:$A$9)),
IF(Front!$C8 = TRUE, SEARCH(Front!$B8, $C$2:$C$9), LEN($A$2:$A$9)),
IF(Front!$C10 = TRUE, SEARCH(Front!$B10, $D$2:$D$9), LEN($A$2:$A$9)),
IF(Front!$C11 = TRUE, SEARCH(Front!$B11, $D$2:$D$9), LEN($A$2:$A$9))), "No Values Returned in filter. Please try again.")
This should do what you're looking for.
Update
I've been asked to show how this function works.
To start with the IFERROR this is wrapped around the main function, so if the FILTER returns nothing, the user is not met with an error message.
The bulk of the function is built around FILTER which acts as a proxy for QUERY, which is what #Sam Breddy originally tried.
Working with the checkboxes that evaluate to TRUE or FALSE depending on if they have been checked or not, we can started to create our dynamic filtering function.
The first filter parameter ... IF(Front!$C2 = TRUE, SEARCH(Front!$B2, $B$2:$B$9), LEN($A$2:$A$9) ... determines if there are any Apples in $B$2:$B$9 only if the checkbox in Front!$C2 is set to TRUE.
The trick here is to have a valid value for when the checkbox is FALSE. If the FALSE parameter was set to nothing / blank, an error would pop up:
FILTER has mismatched range sizes. Expected row count: 8. column count: 1. Actual row count: 1, column count: 1.
To counter this, I'm just returning the first column's length back to the function with LEN($A$2:$A$9) which will have no effect on the filter.
The interesting part is the SEARCH which returns:
The position at which a string is first found within text and ignores capitalization of letters. Returns #VALUE! if the string is not found.
Search finds the String you're looking for ... in this case Apple and then passes that string's location back to the FILTER allowing it to only show the rows where it evaluates to to TRUE.
E.g. SEARCH(Front!$B2, $B$2:$B$9) will return 1
By using a SEARCH method for each subsequent parameter for our FILTER function, they act as an OR allowing the function to evaluate for APPLES or ORANGES.
Honestly, I took a stab at this problem, and ended up coming out on top. I don't think it will work for items in the same column that have the same first letter
E.g. If you're looking for Apples and Andy's in the same column ...
I'm also sure there might be some issues with doing this sort of dynamic filtering over two columns with the same values, but this solution should fit your needs.
Cheers,
I have a editable UI-grid in my page. The first column is a dropdownlist with many options. Depending on the item that the user selects in this first column, the second column must accept only number or hexadecimal.
It's possible to define type from a specific cell? Does anybody have a example?
Thanks.
try this:
type
the type of the column, used in sorting. If not provided then the grid will guess the type. Add this only if the grid guessing is not to your satisfaction. One of:
'string',
'boolean',
'number',
'date',
'object',
'numberStr'
Note that if you choose date, your dates should be in a javascript date type
from http://ui-grid.info/docs/#/api/ui.grid.class:GridOptions.columnDef
$scope.gridOptions = {
columnDefs: [ { field: 'col1', name: 'First Column', type: 'number'} ],
data: data
}
I would like to perform a multi criteria search of data in a column- contains data of check boxes(more than one option chosen).
For a clearer picture of what I am trying to do, screenshot below is a question in a form
Data from the form are saved in sheets like below,
So my concern here is if I would like to search/filter for the rows that contain "Commercial", the rows with Commercial,Engineering doesn't show up. That's definitely not an effective search.
Any advise on how can I go about this issue is kindly appreciated. If
Let's say you have your form in the response sheet in columns A to P, with the multiple choice in col D. If you want to filter your data on the word 'Commercial' you can either do:
=filter(A2:P, regexmatch(A2:P, "Commercial"))
or use query():
=query(A2:P, "select * where B contains 'Commercial' ")
Note: depending on your locale you may have to change the commas to semi-colons in order for the formulas to work.
I hope that helps ?
Following JPV's answer, I developed a line to make the query useful if you want to cross two categories. Let's suppose that someone in your checkbox example had picked all the options (IT, HR, Commercial, Engineering); and that you have created the cell with the dropdown option box in cell B1 with all your options, as JPV said.
Then, you want to filter and see all the people who had chosen IT and Commercial. You would, for that, create a second cell with the dropdown option box in, lets say C1; and then your query would be:
=query(A2:P, "select * where B contains '"&B1&"' and B contains '"&C1&"' ")
=FILTER(MOBILE!A2:E2000, ISNUMBER(SEARCH(A1,MOBILE!A2:A2000)))
SEARCH function will return a number of the position of the searched word (A1) in the searched strings in range (MOBILE!A2:A2000).
If the result of search is a number (ISNUMBER), then filter will return the TRUE rows result from the range MOBILE!A2:E2000.