I am using https://github.com/stwe/DatatablesBundle for my symfony2 application. It's still buggy but works great. Now I want in my table I have id, name for the id. I want to add check box so that I can select them by their id. I've searched enough but couldn't find any solution. Can anyone help me how can I add check box to the column id as select?
One thing : my 'serverSide': false.
$this->columnBuilder
->add("id", "column", array("title" => "Id","type" => "checkbox",))
->add("name", "column", array("title" => "Name",))
this is my code for generating the column.
ok, I found the solution, im not sure if this is the best way to solve the problem but still i can workout my issue.
->add(null, "multiselect", array(
"attributes" => array(
"name" => "check", ),
"actions" => array(
array(
"route" => "artist_show",
"route_parameters" => array(
"id" => "id"
),
"label" => "Select",
)
)))
adding the multi select option solve the necessity of have a check box
Related
Part of my mapping is:
"current_price" => ["type" => "float"],
"price_history" => [
"type" => "nested",
"properties" => [
"date" => ["type" => "date"],
"value" => ["type" => "float"]
]
As you can see I keep in storage current price of goods and all the previous values. First thing I would like to notice is when I create goods in a very first time, I have no history, of course. That's why when I create goods, I do not use price_history at all, although it exists in my mapping.
$params = [
'index' => config('storesettings.esIndex'),
'type' => config('storesettings.esType'),
'id' => $id,
'body' => [
...
"current_price" => $request->get('current_price'),
...
]
];
When I edit goods, I change the price. In this case I need to move the current price to archive, moving it to price_history field. And then I need to replace current name. The question is about price_history field. I get previous value ($goods['_source']['price_history']) then I add to this array current_name. Everything is fine when I already have some history. But if I have not, then I get the error 'Undefined index: price_history'. In this case I should do checking: if(isset($goods['_source']['price_history'])). Is it normal? In relational databases I would have an empty array, but in Elasticsearch I haven't and I must do array level (so to speak) checking. How to handle such cases? Maby I should add an epmty array to price_history when I create goods?..
I am new user in WordPress. I have a problem in option framework. I cannot make options for my use. I want a box which contains font name where the user can select. that is why I use this code in functions.options.php:
$of_options[] = array( "name" => "Select Google Font",
"desc" => "Normal Select Box.",
"id" => "google_font_select",
"type" => "select",
"options" => array("PT Sans","Open Sans","Droid Sans")
);
but it doesn't shows me a select box. it shows like this image in admin panel.
please help me in this issue.
I have just used the select with multiple options in options framework. Here is what i have done in one of my project.
First, i have made an array of text for options value for selection.
And, here is the actual code. That i successfully run in my website.
$options[] = array(
'name' => __('Services', 'ascent'),
'type' => 'heading');
$text_array=array('java','c#','php');
$options[] = array(
'name' => __('Service Title', 'ascent'),
'desc' => __('Change title', 'ascent'),
'id' => 's_title1',
'type' => 'select',
'options'=>$text_array);
return $options;
Hope, this will helps you to used in your project.
I have a elasticsearch index which i update every 10 minutes via cronjob. In this index i have a completion field which works as expected.
But i have one little problem. Lets say i have a "article" field where i change a value from "a" to "b". After 10 minutes the index is been updated and the document which holds article "a" is been updated to article "b". Everything as expected.
But my completion field now holds both values. "a" and "b" both with the same id.
How can this happen?
Mapping:
'suggest' => array(
'type' => 'completion',
'payloads' => true,
'preserve_separators' => false,
'search_analyzer' => 'standard',
'index_analyzer' => 'standard'
),
How i set the field:
'suggest' => array(
'input' => array(
$result["Name"],
$result["Name"],
$result["Name2"],
$result["Name3"],
$result["Name4"],
$result["Name5"]
),
'output' => $result["Name"].' (' . $result["Name1"].', '.$result["Name2"].')',
'payload' => array(
'id' => $result["ID"]
)
)
Found the answer in the docs.
The suggest data structure might not reflect deletes on documents immediately. You may need to do an Optimize for that. You can call optimize with the only_expunge_deletes=true to only cater for deletes or alternatively call a Merge operation.
Here is the form helper I have used for checkbox
<?php
echo $this->Form->input('name',array('type'=>'checkbox','options'=>$options));
?>
and $options array is as follows:
[options] => Array
(
[58] => 58
[85] => 85
)
But I am getting only one check box with both values in it. How can I get check box for each values.
Use the multiple attribute.
echo $this->Form->input('Name',array(
'label' => __('Label',true),
'type' => 'select',
'multiple' => 'checkbox',
'options' => $options,
));
Another thing you have to check, and this is truly a general rule in cakephp when things do not run as expected. is:
"Are you properly closing the form? Do your inputs stay inside <form>...</form>? If you are not sure how to check simply use your preferred
DevTool and check the rendered HTML page.
This is almost the thing I forgot to check mostly and which always let me waste a lot of time!
If your are creating the $option variable in the view this will help you :
$options = array("key" => "value" , "key" => "value" , "key" => "value");
But if you are setting it the controller this will help you :
$this->set('options', array("key" => "value" , "key" => "value" , "key" => "value"));
key is the value in each option of the select input
value is the text of the option tags
I have tried every tutorial on the internet , I have asked questions here and got some good answers which I have accepted and followed. I have created modules, altered core files , installed various versions of magento , but it doesn't matter what I do I cant get anything I DO TO STORE IN THE DATABASE!
I just want to be able to created a custom field on the new account form and store it in the database, I don't care where ?
I had same problem and it is being caused by using uppercase letter in your attribute name.
If you use only lowercase letters everything gets saved just fine.
Make a setup script like this:
<?php
$installer = $this;
$installer->startSetup();
$eav = new Mage_Eav_Model_Entity_Setup('core_setup');
$eav->addAttribute('customer', 'my_property', array(
'label' => 'My Property',
'type' => 'varchar',
'input' => 'text',
'visible' => true,
'required' => true,
'position' => 1,
));
$installer->endSetup();
Then you should be able to add the my_property as an input on the New Customer form.
More on EAV at Alan Storm's Blog
Check these MySQL tables to make sure you're new EAV attribute has been inserted properly.
The attribute name should be in eav_attribute with all the atrribute settings and a new attribute_id. The new attribute_id should be in new records in these 3 tables: customer_eav_attribute, customer_eav_attribute_website, customer_form_attribute.
In customer_eav_attribute,customer_eav_attribute_website make sure the is_visible field is set to 1.
If all this checks out, report back with dumps of the 4 new rows I just mentioned so we can check for anything else that might be wrong in the DB. I just recently added new attributes on Magento 1.6.1 and I was nearly tearing my hair out but got it working in the end.
When I haved this problem was becaus was missing code like this
$installer->addAttribute("empresas", "email", array(
"type" => "varchar",
"backend" => "",
"label" => "Email",
"input" => "text",
"source" => "",
"visible" => true,
"required" => true,
"default" => "",
"frontend" => "",
"unique" => false
));
$attribute = Mage::getSingleton("eav/config")->getAttribute("empresas", "email");
$used_in_forms = array();
$used_in_forms[] = "adminhtml_empresas";
$attribute->setData("used_in_forms", $used_in_forms)
->setData("is_used_for_customer_segment", false)
->setData("is_system", 0)
->setData("is_user_defined", 0)
->setData("is_visible", 1)
->setData("sort_order", 100)
;
$attribute->save();
in my setup script after $installer->installEntities();