How can we remove the placeholder text in ag grid Date filter? - ag-grid

Currently it is shown as mm/dd/yyyy in the filter search box.I need to remove this text and display nothing in the text box.Kindly help on this.
And also can someone explain how can we use the filterplaceHolder property in the filterparams function?
{
field:'date',
filter:'agDateColumnFilter',
minWidth:150,
filterplaceHolder : ''
}
I tried this but its not working.Pls help.

Related

Return different datatypes crystal formula

I have a requirement where depending on the parameter selected the table field should be displayed as text or date. For eg, if the user selects a true, the OriginDate field which is a datetime type should be displayed as a date in the report else should be displayed as a text. I tried creating a formula an doing something like below, and then placing the formula in the details section of the report but it doesnt work due to different datatypes returned.
if {?Mailmerge}=true then
ToText({Travel.OriginDatetime}, "M/d/yy")
else
{Travel.OriginDatetime}
Is there a way I can accompalish the above requirement so that I do not end up creating 2 reports one with field displayed as text and other as date?
Try creating a formula that returns your field as a string totext({Travel.OriginDateTime},"M/d/yy") and overlay it with the original field {Travel.OriginDateTime} and conditionally suppress them based on the value of {?MailMerge} such that only one shows in any one instance of the report.
If I'm following you, you want to only show M/d/yy when ?MailMerge is true, otherwise yuo want to show the full date?
You can't show different datatypes in the same formula, so just convert them both parts of the conditional statement into strings:
if {?Mailmerge}=true then
ToText({Travel.OriginDatetime}, "M/d/yy") // 8/30/12
else
ToText({Travel.OriginDatetime}, "M/d/yy hh:mm:ss") // 8/30/12 02:06:00
I don't know what exactly your dates look like in the database, but you can use the above as a guideline into formatting your date based on the ?MailMerge parameter.

silverstripe backend linebreaks in content do not show up in frontend

I have a textareaField in Silverstripe Backend in Edit Page View... The text to insert contains linebreaks. If I save the Page the text shows correctly with linebreaks in the textareaField. The linebreaks are for sure saved correctly to the database. But how do I display the text correctly in the frontend? It´s always outputted without linebreaks in a single line.
I tried already $Text.RAW, $Text.XML,... nothing works.
Thanks for the help,
Kind regards,
Florian
Assuming that you are using 3.0 this is a bug. You can see it here http://open.silverstripe.org/ticket/7596
A work around is to write your own function calling nl2br on your text field.
Here is an example:
public function NiceDescription () {
return (nl2br (Convert::raw2xml ($this->Description), true));
}
You can replace "Description" with the name of your text property.
Then in your template file if you need to display the description field you will call the function:
$NiceDescription
to visually render the newlines in html, you need to convert them to <BR> tags.
see http://php.net/manual/de/function.nl2br.php

SmartGWT - Display date in yyyy/MM/dd format

I want to have the possibility to display a date with the possibility to enter the date manually.
For this I've uset the attribute useTextField set to true like:
setAttribute("useTextField", true);
Now I want the format of date to be yyyy/MM/dd.
I've tryed with
setAttribute("displayFormat ", "TOJAPANSHORTDATE");
setAttribute("inputFormat ", "YMD");
but nothing happen.
I need to use attributes.
What attribute should I use? And with what value?
Please, need help.
Thanks you a lot.
You can try
.setDisplayFormat(DateDisplayFormat.TOJAPANSHORTDATE);

Dynamic JQuery date picker code

I need to create dynamic filter that adds/removes rows dynamically.
It contains a drop-down box. Depending upon the drop-down box value selected, I create a dynamic <TD> that may have a text field or drop-down list.
If it's a text field, then I have to add date picker for that text field.
I have done this, except date picker for dynamically generated text field.
If you're creating 100 rows, the text fields' names should be same for all rows.
How to add datepicker for dynamically generated text field?
I had the same issue.
You would need to rebind the DatePicker to the dynamically added row.
The date picker associates a hadDatePicker Class to the dynamic row.
So you would need to remove that and rebind.
Something like this -
jQuery('.date-pick').removeClass('hasDatepicker').datepicker({
dateFormat: 'mm-dd-yy'
});
Regards,
Tina Agrawal
Actually i did use the solution provided by #Tina Agrawal But since now, when i select a date from the calendar, i click again and re-select. If i click on next month, it will go to 1900-01-01.
Well it was so strange...
After two hours of trial and errors and research.
i simply did:
$('.date-pick').live('click', function(){
$('.date-pick').datepicker();
});
Well it works.
I had the same issue and solved it in a different way. Although I am not very sure why is it working as I am very new to jquery. I wrote the following and it iterates the entire set of controls having the class "class_date" and rebinds the datepicker control to it.
$(".class_date").removeClass('hasDatepicker').datepicker();
Tirst add a class attribute as "date" to your input or div.
After dynamically add a text input to have to recall $('.date').datePicker() again to bind datePicker to new inputs or div.
I had a similar problem in that when dynamically adding new rows to my table the Date Picker fields in the new rows (any row added to the DOM dynamically) were all updating my initial rows Date Picker fields.
Removing the hasDatepicker class as suggested above was not enough to solve my issue, probably as I was using .clone() to create my dynamically added rows.
The solution when cloning rows was to remove the cloned input fields, re-create them, add them to my newly cloned table row and THEN re-initiate the Date Picker
For example:
//Remove exisiting cloned input fields
new_row.find("td.date input").remove();
//Create new input fields and append to table td
var date_tds = new_row.find("td.date");
$('<input />', {"name":"gStartDates["+n_array_pos+"]","type":"text"}).appendTo(date_tds[0]);
$('<input />', {"name":"gEndDates["+n_array_pos+"]","type":"text"}).appendTo(date_tds[1]);
//Re-initiate datepicker on the input fields
new_row.find("td.date input").datepicker({
dateFormat:"dd-mm-yy",
minDate:StartDate,
maxDate:EndDate
});
Use JQuery Live to access the dynamically created DOM.
http://api.jquery.com/live/
The you can attached the picker.
http://jqueryui.com/demos/datepicker/
one should use ".on" instead of live - see
http://api.jquery.com/on/

JasperReports: default value instead of 'null'

Is there any way to set a default value to a field in a report? I have a lot of String fields in a report and would like them to display "0,00" when they're null.
Supposing the field name is "value", in the "Text Field Expression", write:
($F{value} != null) ? $F{value} : "0.00"
You can also select "Blank when null" in the properties of the text field if you want that. Other options are more flexible but this does the trick very quick and easy.
medopal's answer is good, but 2 additions:
1) You can make the syntax shorter:
($F{field_name}) ? $F{field_name} : "0.00"
2) Make sure your "else" data is of the same class as the field's value, otherwise you'll get errors when it tries to coerce numbers into string, etc. etc. This was something that, as I started out, I mixed up.
Did you try set a pattern in the text field?
If you are using iReport this can be found in the properties for the text field in the Text Field Properties section.
Try something along the lines of ###0.00 to represent 1234.56, which would always display 0.00 even if it is null.
This is the easiest way is to use Coalesce() or NVL() function of database in your data-source query to restrict null data on your report.
But it depends on if you are allowed to change the datasource query or not. If not then you can go for other solutions provided in previous answers.