Atk4 form Columns - atk4

I'm trying to use columns in a form.
I have the next code, that produces the
The code is this:
$col=$this->add('Columns');
$left=$col->add($f->addField('text','observaciones'));
$right=$col->add($f->addField('line','cantidad_de_bocas'));
the fields of the columns, are based on form fields. I whant to add more than one field to the columns (ex. 2 fields on left column and 4 fields on right columns).
I have seen some examples about this, like
$col=$page->add('Columns');
$left=$col->addColumn(2)->add('View_SlotMachine');
$right=$col->addColumn(2)->add('View_SlotMachine');
Why the fields are duplicated ?
What does the method addColumn(2) does ?
Very thanks

If you havent gone to far with development using atk 4.1, you could download 4.2 and look at the examples here. There is a lot of new functionality in 4.2 which you can take advantage of and the demos and examples are being updated to reflect these changes.
In 4.2, there is an example of styling with two columns like this
class StylingForm extends Form {
function init(){
parent::init();
$f=$this;
$f->addField('line','name')->validateNotNull()
->setFieldHint('Click "Register" to see error');
$f->addField('line','email')
->validateNotNull()
->validateField('filter_var($this->get(), FILTER_VALIDATE_EMAIL)')
.. .. ..
}
functoin init() {
// Stacked class puts labels on top of fields
$form=$page->add('StylingForm');
$form->addClass('stacked atk-row');
$form->template->trySet('fieldset','span6');
$sep=$form->addSeparator('span6');
$form->add('Order')->move($sep,'before','age')->now();
}
In atk4.1, the form is a view so it has a template in atk4/templates/shared/view/form.html and some code in atk4/lib/View/form.php
In the example of the slot machine that you mention from here the addColumns(2) is being used to set the width of the views to 20% of the available screen width but in the example, each column will contain a view of the slot machine. If you wanted to forms on the same page, you could use the same functionality, but what you appear to want is a single form across two columns with a single submit button.
If you have to continue to use atk4.1, you need to look at the form.html. Romans may be able to suggest how you could create a two column form in that version. I can see there are some classes defined in the css such as atk-form-vertical-2col and atk-form-vertical-3col and there is a function setFormClass to set them but i cant see what tags you would set to put fields into the right hand side - by default, everything goes to the left.

Related

Angularjs How to manage Code

I am new to Angularjs. I have a page like this.
I have a single controller which does all the work which is currently working fine. I want to manage my code to use angular-given-functionalities by using filters, services, controllers etc.
In this page i have many sections i am mentioning here.
Search filters
Category
Attributes
Tags
Pagination Section plus Grid or List links
Sort plus Compare section
Product data to display
How can i break my code in separate chunks to manage it properly.
I have created a service which does all ajax related work.
Here is the dependency.
1. Search does nothing except page redirect
2. Category can have a view more which will update itself will more then 10 records
3. Attributes can have viewmore button to display more then 10 attributes. Attribute can also impect on the following
When we select single on multiple attribute it will change
1. Category
2. Attributes
3. Tags
4. Pagination
5. Listing (Product data to display)
4. Tags can be removed and can have excatly same behavior as Attributes
5. Pagination will change itself and product data display
6. Sort will have same as pagination
7. Nothing
I dont need code just some suggestions on how can i choose things from Angular to make managed code.

Overview page of elements from a Typo3 page tree

I'm primarily a UI and graphic designer and, eventhough I have some experience with Typo3, I'm completely stuck at the following problem:
I have a large page tree with single pages for items from a catalogue (one item per page), the layouts for these items are built with Armin Vieweg's beautiful "Dynamic Content Elements" extension (DCE).
Now I want to create an overview page where I reference some of those items automatically - ideally I want to check a box in each element I want to display there (I would add a field catalogueItemPreview to the item DCE which authors can check or uncheck).
Unfortunately, I have no concrete idea of how the database is structured and how I could build a query (where would I even do that? in a custom-made plugin?).
This is how I imagine it could work: On the overview page I use a plugin/an extension in a Content Element that does the following:
search Typo3 DB for content elements with a field called "catalogueItemPreview"
return fields "catalogueItemTitle", "catalogueItemShortDescription", "cataloguePreviewImage"
use a template to render previews of all those elements on the overview page
I'm happy for ANY pointers towards a solution as currently I'm completely in the dark about where even to begin ...
Schematic screenshot from the Typo3 backend
thanks for using my DCE extension :)
Well the fields you have defined and their values in content elements are stored as XML, because the current version of DCE is based on Flexforms.
This makes it very very difficult to do MySQL queries using one of the field properties in WHERE clause. You could check for a xml string in the field pi_flexform but this is not recommended.
Instead I would use another property of content elements (tt_content) to mark the items as "Show on frontpage". For example you could create a new layout or section_frame value for that. Then it is very easy to just output the elements you want, using TypoScript.

Dataview List and items

I am looking at a different way of doing my application.
Actually It's kind of static. My Projects have Categories. Each Category has Subcategories. Categories are containers and Subcategories are element which have values that can be edited.
After analysis of the data , we saw that it was not enough general for it. We are now looking at a Tree Structure. Doing so, we would have Projects filled with Folders/Categories) and those Folders would be filled with other Category/Folders or with SubCategories/Items/Files. That way we can go has deep has we want in complexity.
That is doable, I know it. What I need to know is how hard it will be to implement it in the app.views...
Is it possible to have a single Ext.DataView.dataview display different Ext.DataView.component.DataItem side by side.
Exemple : Having a row in my List that shows a slider and update itself according to it, but that on the 2nd row it is an arrow that on click would open the next level of my Tree.
Visual:
DataView_List
Small Car---------------------------Label------------------------SLIDER
Fuel----------------------------------Label------------------------------ >
SUV----------------------------------Label------------------------TxtField
Small Car and SUV are leaves with different template and Fuel is a category/folder that need to open on click.
So I already have 3 differents templates that would need to show in the same dataview list.
How should I proceed to achieve such results? Is Dataview List the way to good or should I implement my own kind of list inside a container?
If you want to present different kinds of data inside one list or dataview - you can achieve by following strategy:
You still need to use one store to keep it all
In the model class include something like 'record_type' field indicating what kind of data you have
Combine all data you need into one model
Create a template that based on the 'record_type' would render different content
Here is how your template would look like:
<tpl switch="record_type">
<tpl case="car">
<div>CAR + SLIDER</div>
<tpl case="fuel">
<div>FUEL + LABEL</div>
<tpl default">
</tpl>
This is screenshot from my list which contains multiple record types and uses this approach:

How to remove a field from Views 3 programmatically?

Hi I'm using Drupal 7 and Views 3. I have a view (named 'export') that generates a csv export of selected node entities. However, I've put some custom code in that displays all the fields contained within that selected node entity, and allows the user to select fields (via checkboxes) that they do not want to include in the export.
I've tried unsetting the selected fields within hook_views_query_alter like so:
function mymodule_views_query_alter (&$view, &$query) {
if ($view->name == "export") {
unset($query->fields['field_data_field_description_node_entity_type']);
}
}
While that does unset that part of the fields array, I still get the description field populated in the csv export. I'm just not familiar enough with the views object structure to fully understand how to remove a given field from the view. I've searched the web for literally hours trying to find a post to shed some light on this. While I've found plenty of examples for using hook_views_query_alter to add filters or alter the WHERE statement of a query object, I haven't found anything having to do with removing the columns that a view query returns. Any advice on this would be very much appreciated!
Thanks,
axl
I was able to remove views fields for a CSV export by unsetting the field in hook_views_pre_build() in my custom module.:
function mymodule_views_pre_build(&$view) {
if ($view->name == 'campaign_report'
&& $view->current_display == 'views_data_export_1') {
// You'll have your own list of fields to remove that you create somehow...
$fields_to_remove = array('field_name_to_remove_1','field_name_to_remove_2');
foreach ($fields_to_remove as $field_name) {
unset($view->field[$field_name]);
unset($view->display_handler->handlers['field'][$field_name]);
}
}
}
This seems to work great for me, and is performed earlier in the views life cycle, before the query is even built. In fact I started using it for my table display view as well as my CSV export, since it seems more efficient than using the "hide if empty" column checkbox on the Views table settings (which must iterate over every row in the result set to see if it's empty in order to hide the column heading). If you wish to do that too, you will need to change the if() statement at the top so it only checks $view->name. Then the fields will be removed from all displays in that view (not just the views_data_export_1 display).
Try removing the column from the $view object.
unset($view->field['field_name'];

Can extjs Control/toggle groupField data?

here is the example edited by crop grid:
1st i view like a normal grid like this image
http://imageshack.us/f/836/groupcontrollingb4.png/
then i create a check box name as "Cuisine:American" and check it to reload become image like this
http://imageshack.us/f/803/gridcontrollingafter.png/
the group data "Cuisine:American" can be group it and expand
then other data still remain the normal grid view
Does any one know a example or possibility for controlling the groupView like in the example i've shown ?
Hope u all can understand my question
thankz.
It's harder than it should be, because ext is not calling Ext.util.Grouper.getGroupString method. I've managed to bypass this. Here is working sample: http://jsfiddle.net/bP7Y2/
I am basing on Grouped Grid Example from Ext JS site. I've created CuisineGrouper which is extending Ext.util.Grouper. There are 2 important methods: getGroupString which returns gruping string and sorterFn which sorts in that way that grupped elements are on the top. For example when there is grouping by 'Cuisine:American' getGroupString returns 'American' or '' depending on cuisine value.
Another important bit is overriden getGroupString method on Restaurants store, so now it calls Ext.util.Grouper.getGroupString.
Last thing I've modified is groupHeaderTpl of groupingFeature.
(Update) It's possible to hide Others grouping header with some hacks. Example: http://jsfiddle.net/bP7Y2/1/

Resources