w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Primefaces Datatable lost text in Filter field after datatable update
You can't (PrimeFaces 3.5) directly bind datatable filters with JSF bean, so they will not be preserved when you update the whole component. But if you call filter() on datatable widget, the data will be reloaded from server, without re-rendering the whole datatable component (so the filters will be preserved) <p:dataTable .... widgetVar="myTable"> ...</p:dataTable> <p:commandButton action="#{myBean.doSth}" .... oncomplete="myTable.filter()"/>

Categories : JSF

Django template : use a filter result as an argument to a second filter
Don't do that. The Django template system is not the place to put such a logic. Read the Philosophy comments about templates in the Django official website: If you have a background in programming, or if you’re used to languages which mix programming code directly into HTML, you’ll want to bear in mind that the Django template system is not simply Python embedded into HTML. This is by design: the template system is meant to express presentation, not program logic. I think the Timmy's comment is right, put the entire logic in a custom filter.

Categories : Python

Filter DataTable in c#
You can use LINQ to DataSet var rows = table.AsEnumerable().Where(r => r.Field<int>("ID") == 1); BTW according to desired result you should filter by ID.

Categories : C#

style not applied for " footer" in IE
Your problem is with IE not with RichFaces. By the looks of it IE has problems with transparency. You can try background: transparent or setting transparent image for the background.

Categories : CSS

Change ColVis Style in Datatable javascript
Looks like you can edit the css for the button in extras/ColVis/media/css/ColVis.css .ColVis_Button { position: relative; float: left; margin-right: 3px; padding: 3px 5px; height: 30px; background-color: #fff; /* here */ border: 1px solid #d0d0d0; cursor: pointer; *cursor: hand; } Can't really see a way to do this using the api or options. I suppose you could do this: $('.ColVis_Button').css("background-color", "red");

Categories : Javascript

Filter data from DataTable
Simply check if your Select returns anything? DataTable dtt = (DataTable)Session["ByBrand"]; DataRow[] rows = dtt.Select("Price >= " + HiddenField1.Value + " and Price <= " + HiddenField2.Value + ""); if(rows.Length > 0) { var filldt = rows.CopyToDataTable(); } Well, the Linq example from Tim is really nice, but to complete my answer. The Select method returns Always a DataRow array also if there is no row selected, but then you cannot ask to build a datatable from this empty array. Think about it. What schema the CopyToDataTable should build for the resulting table if no rows are present in the array?

Categories : C#

A filter with the certain values for a datatable
DataTables custom filtering (range filtering) plug-in example can help customize filtering of people's age.

Categories : Javascript

filter a datatable to contain unique columns
You can use LINQ to DataTable with GroupBy method: var result = dt.AsEmumerable() .GroupBy(row => row.Field<string>("Name")) .Select(g => g.First()) .CopyToDataTable();

Categories : C#

Add onkeyup event on datatable filter
You can achieve this with some jQuery magic. I was using PrimeFaces 3.5 to determine this answer but you should be able to achieve the same thing on yours. The first thing you'll need to do is to determine the generated id for the input on the HTML side. You can do so by right clicking on the input (the one used to filter for that column) and choose View Source. Note: I found it easier to simply add an id to <h:form>, <dataTable> and the <p:column> you're interested in (or you can do prependId = "false" on <h:form> to shorten it...whatever you wish). Then use this javascript (pseudocode) code . $(document).ready(function(){ $("#inputTextId").keyup(function(){ //logic goes here. }); }); Here's a more concrete example. Below is a portion of my <p:dat

Categories : Java

Filter Datatable through date-range in JSF
Updated (according with comments): <!-- outside from dtable --> <p:calendar widgetVar="var1" id="dtFrom" value="#{bean.dateFrom}" pattern="yyyy-MM-dd" mode="popup" showOn="button"> <p:ajax event="dateSelect" listener="#{bean.dateFilter}" update="dTable"/> </p:calendar> <p:calendar widgetVar="var2" id="dtTo" value="#{bean.dateTo}" pattern="yyyy-MM-dd" mode="popup" showOn="button" > <p:ajax event="dateSelect" listener="#{bean.dateFilter}" update="dTable"/> </p:calendar> <!-- datatable code --> <!-- keep in your datatable this column according with your location --> <p:column id="dateColumn" headerText="Date of Birth" > <h:outputText value="#{row.dob}" > <f:convertDateTime pattern="yyyy-MM-dd HH:m

Categories : JSF

Datagrid not updating DataTable when applying a "single click" Style
I think you have to define your own cell template with a checkbox inside. Source : http://social.msdn.microsoft.com/Forums/vstudio/en-US/e1858654-26bd-4050-a1be-1f5d0209b1fe/how-do-i-change-a-datagrid-checkbox-without-clicking-twice

Categories : Wpf

How do I use LINQ to filter a datatable against a Lst of strings that need to be split?
List<string> list = { "8/1/2013 9:57:52 PM|Login for bill.lock@cap.com", "8/1/2013 9:57:37 PM|Login for bill.lock@cap.com" }; var a = dt.AsEnumerable().Where(x=> !list.Select(y=> new { Time = DateTime.Parse(y.Split('|')[0]), Text = y.Split('|')[1] }) .Any(z=> z.Time == x.Time && z.Text == x.Text)); or var a = dt.AsEnumerable().Where(x=> !list.Any(y=> y == string.Format("{0}|{1}",x["Time"],x["Text"]))); DataTable newTable = a.CopyToDataTable();

Categories : C#

How to update an element in a datatable result?
I want to update row["Gender"] = "male" and by uncommenting above code following error occurs "String was not recognized as a valid Boolean." So the type of the DataColumn Gender is bool instead of string. So either change it to be string in the first place or use a second column for your string representation. Assuming that Get_Data returns a DataTable which is filled from database. Then it would be the best approach to select the desired string for your bool, for example: SELECT Id, Col1, Col2, Col3, CASE WHEN Gender=1 THEN 'Male' ELSE 'Female' END AS Gender FROM dbo.Data WHERE Id = @Id

Categories : C#

primefaces datatable filter do not work in subsequent clicks
This problem is simmilar to this one: Ajax update doesn't work, when using filter on datatable (JSF, Primefaces) Try calling tasksTable.filter() after the ajax call is made: <p:ajax event="filter" update="@this" oncomplete="tasksTable.filter()" />

Categories : Java

how to create individual column filter in jquery datatable
Add input field in required place and add the following code after initiating datatable. Tested with PHP application. $('#inputFieldID').keyup( function() { oTable.fnFilter($(this).val(), 0); });

Categories : Jquery

Formatted number range filter - jquery datatable
You can use my Yet Another DataTables Column Filter (Yadcf) plugin Take a look at the example, in short all you need it to use filter_type: "range_number" for your column. Take a look at the examples and the docs in the jquery.dataTables.yadcf.js file

Categories : Database

In primefaces dataTable Sort and Filter Not Preserved with Poll
Can you try to give an Id to your dataTable and then call dataTableId.filter? It works for me. <p:poll id="pollAutoUpdate" interval="5" oncomplete="entityTable.filter()" autoStart="false" stop="true" widgetVar="myPoll" />

Categories : JSF

dataTable search[Filter Plugin] doesn't work until change
Instead of trying to hack around the ui, why not use the DataTables api for this: http://datatables.net/api#fnFilter So when you're dropdown list changes, you could call the fnFilter function on your datatable: $('#dropdownlist').on('change', function() { var val = $(this).val(); var dataTable = $('#table').dataTable(); dataTable.fnFilter(val); });

Categories : Javascript

Reset PrimeFaces DataTable state (filter, sorting, paging)
Finally, I found the solution, hidden in this sample http://www.primefaces.org/showcase-labs/ui/datatableDynamicColumns.jsf on tab TableBean.java: dataTable.setValueExpression("sortBy", null);

Categories : JSF

Linq to DataTable query missing the first record in result set
Try to use only Date part of your dates for comparison: from r in dt.AsEnumerable() let date = r.Field<DateTime>("Date") where date.Date >= start.Date && date.Date <= end.Date orderby date ascending select r;

Categories : C#

Fetch Linq to Entity result directly into Datatable
You can't call a method that can't be translated into SQL query, you should do in 2 steps like this: var menuItems = from vUser in dbMenu.VirtualUserMenuMaps join menu in dbMenu.MenuMasters on vUser.MenuId equals menu.MenuId join subMenu in dbMenu.SubMenuMasters on vUser.SubMenuId equals subMenu.SubMenuId where vUser.VirtualId == virtualId orderby menu.MenuId, subMenu.DisplayOrder select new { menu.MenuName, subMenu.SubMenuName, subMenu.FileName }; foreach(var row in menuItems) dtMenu.LoadDataRow(new object[]{row.MenuName, row.SubMenuName, row.FileName}, false);

Categories : C#

Paginated Primefaces dataTable leaves out first result on initial loading
I ended up getting around this problem. I'm still not sure why that peculiar behavior was occurring, but my solution was just to refresh/reset the dataTable through Java once the page was loaded up. The following code ended up working: final DataTable d = (DataTable)FacesContext.getCurrentInstance().getViewRoot().findComponent("ResultsTable"); d.reset(); Basically, since refreshing the screen or going to the next page in the dataTable ended up showing the missing result, I figured forcing a reset on the server side would end up fixing the issue. Looks like it worked! Sanjeev

Categories : JSF

Convert type of a columns in datatable
When importing the csv file if you already know the column types beforehand then you should make a table with those columns and then fill the data. Cloning a table and then filling the data again is very slow process especially if data is large You can refer to the following http://social.msdn.microsoft.com/Forums/windows/en-US/34b6a1e8-5103-42a3-aa45-cdc0cea461f2/importing-csv-file-to-datatable-problem-with-converting-data-type

Categories : String

MySQL Filter result again
Try this: SELECT `newest`.ingredient, `newest`.store, `newest`.brand, `newest`.price, `newest`.`latest_date` FROM (SELECT ingredient.name AS ingredient, store.name AS store, brand.name AS brand, ingredient_price.price, MAX( ingredient_price.date ) AS `latest_date` FROM ingredient LEFT OUTER JOIN ingredient_price ON ingredient.ingredient_id = ingredient_price.ingredient_id LEFT OUTER JOIN store_to_ingredient_price ON ingredient_price.ingredient_price_id = store_to_ingredient_price.ingredient_price_id LEFT OUTER JOIN store ON store_to_ingredient_price.store_id = store.store_id LEFT OUTER JOIN brand_to_ingredient_price ON

Categories : Mysql

filter a result with a csv file
Just read those senders from a simple text file: $whitelistedSenders = Get-Content 'C:path osender_whitelist.txt' If you must use a CSV, extract just the values of the sender name column: $whitelistedSenders = Import-Csv 'C:path osender_whitelist.csv' ` | % { $_.'Sender Name' } Then process only those senders not contained in the whitelist: $subjectreport = $senders ` | ? { $whitlistedSenders -notcontains $_.Name } ` | Group-Object MessageSubject ` | Sort-Object Count -Descending ` | ? { $_.Count -gt 50 -and $_.Name -notlike "MicrosoftExchange*" } ` | select Count, Name

Categories : Powershell

C#.NET Error: Unable to cast object of type 'System.Data.DataTable' to type 'System.Data.DataSet'
It's because you're setting the DataSource to a DataTable: gvPartNumber.DataSource = dsgvPartNumber.Tables["partNumbers"]; not a DataSet. So, instead of this: DataSet dsgvPartNumberDelete = (DataSet)gvPartNumber.DataSource; do this: DataTable dsgvPartNumberDelete = (DataTable)gvPartNumber.DataSource; and then in the following lines you won't need accessors like .Tables[0]. It will already be a DataTable and thus more direct to access anyway. This modification would of course have to be replicated to all of your methods where you're trying to cast the DataSource as a DataSet.

Categories : C#

Filter python mysql result
You can use str() to get rid of the u: print str(user) FYI-the u means it is unicode.

Categories : Python

Empty result when filter by NSPredicate
"phoneArray" is an array of strings. To check if any of the array elements contains the given string, use [NSPredicate predicateWithFormat:@"ANY phoneArray CONTAINS %@", @"24"];

Categories : IOS

How to Filter result in MVC 4 based on user
I would just create an action filter that puts the values you need inside a ViewBag and send it over to the view. This way you don't have to rewrite the same code over and over again and you can just concentrate on the view to display the data as necessary. Please see below for sample code: using System.Web.Mvc; namespace CustomActionFilter.CustomActionFilters { public class MyResultFilterAttribute : FilterAttribute, IResultFilter { public void OnResultExecuting(ResultExecutingContext filterContext) { //The action filter logic - before filterContext.Controller.ViewBag.userInfo = GetNeccUserInfo(filterContext.HttpContext.User.Identity.Name); } public void OnResultExecuted(ResultExecutedContext filterContext) {

Categories : Asp Net Mvc

SQL Server : Filter Result by CSV String
This is an example of a set-within-sets subquery. I like to solve these using aggregation. Here the code gets a little bit trickier, because you are listing the colors in a string. select pcp.ProductId, p.ProductName from Product p join Product_Colors_Bridge pcb on p.id = pcb.ProductId join Product_Colors pc on pcb.ColorId = pc.Id group by pcp.ProductId, p.ProductName having count(distinct (case when charindex(pc.Color, @Colors) > 1 then pc.Color end)) = (1 + len(@Colors) - len(replace(@Colors, ',', ''))) The key is the having clause. The first part counts the number of colors that a product has that are in the list. The second counts the total number of colors, by taking the difference in length of the string with an without commas. If you like, you c

Categories : SQL

Filter a list, according to the result of another query
If your data is small enough to fit into RAM, than use replicated join, which is map side join, which is implemented as a membership check.

Categories : Apache

filter query result by user
Try: fq=CreatedBy:user1 qf stands for Query Fields, while fq stands for Filter Query

Categories : Solr

VB.net 2005 Type mismatch with datatable to crystal report
For now, we have resolved to instead pass each Data into a seperate form, then use the PRINTFORM object included with the VB Powerpacks. This is to make sure the image is also printed. I can't help but feel this isn't the proper solution though, so if anyone can still contribute it's very much welcome.

Categories : Vb.Net

CSS selector to check an attribute of a child div and style based on the result?
No, you cannot.. yet. The CSS4 Selectors Spec shows a way to choose the subject of a rule, but it is not implemented in any browsers. To note, hopefully you will be able to do this soon (from the spec) For example, the following selector represents a list item LI unique child of an ordered list OL: OL > LI:only-child However the following one represents an ordered list OL having a unique child, that child being a LI: !OL > LI:only-child

Categories : HTML

Filter query result by most recent date
Say you have a table named [Survey] with the following data RespondentID SurveyDate Answer1 Answer2 ------------ ---------- ---------------------------- ---------------------------- 1 2013-01-01 answer 1, respondent 1, 2013 answer 2, respondent 1, 2013 1 2012-01-01 answer 1, respondent 1, 2012 answer 2, respondent 1, 2012 2 2012-01-01 answer 1, respondent 2, 2012 answer 2, respondent 2, 2012 You can use a query of the form... SELECT Survey.* FROM Survey INNER JOIN ( SELECT RespondentID, MAX(SurveyDate) AS MaxOfSurveyDate FROM Survey GROUP BY RespondentID ) AS MaxDate ON Survey.RespondentID = MaxDate.RespondentID AND Survey.SurveyDate = Max

Categories : SQL

How to filter result with two tags parameters in MySQL?
SELECT prod.* FROM bb_admin.bb_directory_products as prod LEFT JOIN bb_admin.bb_map_product_category as mapcat ON prod.product_id = mapcat.product_id LEFT JOIN bb_admin.bb_categories_products as cat ON mapcat.category_id = cat.category_id LEFT JOIN bb_admin.bb_map_product_tag as maptag ON prod.product_id = maptag.product_id LEFT JOIN bb_admin.bb_tags as tag ON maptag.tag_id = tag.tag_id WHERE (prod.status='1' OR prod.status='3' OR prod.status='5') AND prod.is_catalogue='1' AND cat.slug = 'barongs-suits' AND tag.title IN ('gray','classic') GROUP BY prod.product_id HAVING count(distinct tag.title) = 2 Add a having clause that makes sure a product_id has both tags.

Categories : PHP

AngularJS : filter and bold part of the result
You can make your own custom filter that alters the input based on the search string : angular.module('app').filter('searchfilter', function() { return function (input, query) { var r = RegExp('('+ query + ')', 'g'); return input.replace(r, '<span class="super-class">$1</span>'); } }); This works, but the filter returns html, so you will need to tell angular to treat the result as html. In order to do this, you need to include ngSanitize as a module dependency and insert the result with ng-bind-html. Here's a complete demo : <div ng-app="app"> <div ng-controller="Ctrl"> <input ng-model="search" placeholder="search a fruit" /> <ul> <li ng-repeat="fruit in fruits| filter:search | limitTo:10" ng-bind-

Categories : Javascript

linq limit and filter large set of result
Where first, order next, take afterwards. Like this: Products = repository.Products .Where(x=>x.Description.Contains("Laptop"); .OrderByDescending(p => p.Date) .Skip((page - 1) * PageSize) .Take(PageSize) Note, contains get turned into like %input%, so no need to surround it with %s ;)

Categories : Asp Net

jquery filter not giving proper result
I'm pretty sure that the problem is within the :checkbox selector. Is the console.log running? Anyway I think some assignations more will make the code more legible and less error likely. You can try this example solid http://jsfiddle.net/AyjnW/4/ seems working. $("form").on("click",'input[type="checkbox"]', function(e){ var el = $(this), label = el.parent(), hasParentClass = label.hasClass("green"), elementValue = el.val(), removeElementValue = "remove"+ elementValue, addElementValue = "add"+ elementValue ; if(! hasParentClass ){ label.removeClass("red").addClass("green"); sendStatus = $.grep(sendStatus, function(value) { return va

Categories : Jquery

DataTable from FileHelpers Class -- type.GetProperties() returns empty array
When working with Properties : You need to specify the scope for the Get Properties, try this to return all property types : GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static); When working with fields (i.e. no get/set), its similar, just a different function. See : http://msdn.microsoft.com/en-us/library/ch9714z3.aspx

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.