Flex HSlider Data tip function - flex4

Hi I'm trying to pass in a function to change the tool tip for a HSlider in flex 4 but I keep getting the following error no matter how I try defining the function:
Error #1006: value is not a function
Here's the code
function positiveNumberTips(value:Number):Number
{
return calculations.roundToPrecision((value * -1),2);
}
metricSlider.dataTipFormatFunction(positiveNumberTips);
6 MetricSliders, which are HSliders, are created dynamically so that is why I cannot define the dataTipFormatFunction in a declaration as usual.
The positiveNumerTips function is being used by other static sliders and it is working correctly.
Thanks for any help.

Try this: Your Syntax is wrong.
metricSlider.dataTipFormatFunction=positiveNumberTips;

Related

Javascript callback function with one parameter

I'm trying to get the result of a function (ajaxGetPreference, that contain an ajax call), my code:
highlight_pref = 0;
highlight_pref = ajaxGetPreference('highlight');
console.log(highlight_pref);`
I'm getting always 0. Should I do something like this (see below)? I saw ither similar question, I don't know how to do with the parameter 'highlight'
ajaxGetPreference(function() {
console.log(highlight_pref);
});
Thanks for helping!

codeigniter's link does not work and cannot match with the function parameter

I have the function
index($errorMsg, $successMsg) {....}
It works when I type in the URL.
http://localhost/website/index.php/home/index/1234/5678
But It does not work But when I type in the URL.
http://localhost/website/index.php/home/index//5678
5678 will be $errorMsg.
Is there any hints
Really bad solution for passing success or error parameters via function arguments by get method in CI.
Try use session flash data to pass success or error messages in redirection view.
$this->session->set_flashdata('errorMsg', '1234');
$this->session->set_flashdata('successMsg', '5678');
And show variables:
function index()
{
echo $this->session->flashdata('errorMsg');
echo $this->session->flashdata('successMsg');
}
Use this solution to avoid errors.
Your solution
Declare function like this
index($errorMsg, $successMsg=NULL) {....}
Explanation
index($errorMsg, $successMsg) function required both arguments(variables). If you don't pass it will produce error which is happening in your case.
index($errorMsg, $successMsg=NULL) function required first one and 2nd one is optional.If you don't pass 2nd argument $successMsg value will be null.
Note
/home/index//5678 no need use double slash after index.One will solve your purpose.You need to just check $successMsg.If it is null means you passed only $errorMsg

Firing an Event in Laravel 5

In an attempt to learn using events I have followed this tutorial
In my App\Events\ThingWasDone.php i have this
Session::put('testevent', 'it works!');
$author= Entity::find(261);
$author->still_active_URL = 99;
$author->save;
The Session is properly defined and I can get it in my View files.
Any attempt to write to DB produces this error:
LogicException in Model.php line 2632:
Relationship method must return an object of type
Illuminate\Database\Eloquent\Relations\Relation
I tried options like passin or not passing any variable:
\Event::fire(new ThingWasDone($object->id));
\Event::fire(new ThingWasDone());
Didn't help.
Any hint?
change
$author->save;
to:
$author->save();
This might solve the error.

CSV not to be exported in Magento

I have set the following Code within WebController.php
/**
* Export order grid to CSV format
*/
public function exportCsvAction()
{
$fileName = sprintf('stores-%s.csv', date('Ymd'));
$grid = $this->getLayout()->createBlock('adminhtml/web_web_grid');
$this->_prepareDownloadResponse($fileName, $grid->getCsvFile());
}
I don't know what is the problem that causing CSV not to be exported.
Following error is showing -
Fatal error: Call to a member function getCsvFile() on a non-object in
/var/www/projects/tmp/storelocator/app/code/local/Company/Web/controllers/Adminhtml/WebController.php
on line 0
Please help!
Thanks in Advance.
This line :
$grid = $this->getLayout()->createBlock('adminhtml/web_web_grid');
returns null. The error tells you it clearly :
Fatal error: Call to a member function getCsvFile() on a non-object
Are you sure this 'adminhtml/web_web_grid' relates to a block ?
Do you have a folder/file Web/Web/Grid.php in the Block folder of the adminhtml module ?
For example, if you didn't overload the Mage_Adminhtml module, you should have a class named Mage_Adminhtml_Block_Web_Web_Grid in the folder app/code/local/Mage/Adminhtml/Block/Web/Web/Grid.php that's what the createBlock('adminhtml/web_web_grid') is searching for
Please make sure that you calling right block(Block must be extended by Mage_Adminhtml_Block_Widget_Grid or it might be grid like)
then use your code
You might test by following code by putting in action (its magento core code)..........
$fileName = 'customer.csv';
$content = $this->getLayout()->createBlock('adminhtml/customer_grid')->getCsvFile();
$this->_prepareDownloadResponse($fileName, $content);

Code Igniter Passing Variable to Controller Using URL Error

I am creatting a Code Igniter project in which I want to pass a variable through the URL like a get statement, like this:
url: /site/cake/1
controller function: cake($var)
but when the variable is left blank, I receive an error, how can I get code igniter, to ignore this?
In your controller, do this:
function cake($var = null) {
// your other code here
}
When $var isn't present in the URL, it will be set to null and you'll receive no error.
To explain why Colin's answer works:
The issue you had, was that there was no default value for that controller function. In php, creating a default value for a function parameter is done by assigning it a value in the function definition ($var = false). Now when the cake() function is called with no parameter, it will set $var to false by default.

Resources