Editable field action in sonata list view - symfony

I have a list view in sonata admin. I want to edit integer field directly in list view. New data for this field must change other fields in my entity. How can I add action function to this editable field in which I may do some actions with other fields depending on entering integer value?

Please check documentation: https://sonata-project.org/bundles/admin/master/doc/cookbook/recipe_custom_action.html
Basically, what you need is a custom route and and a controller, same way as you handle any page/request. Than you can do any logic you like making requests to this routes (even with AJAX). Documentation will help you the best with this.
And to add an "editable field" or a link or a button in List view, just create custom template piece: https://sonata-project.org/bundles/admin/master/doc/reference/templates.html

Related

Cannot filter a view based on the field value

Drupal 7
Problem statement: Cannot filter a view based on the field value
I have a content type called support ticket
It has a field called assigned-to which has the list of users to whom the ticket will be assigned
I created a view for support ticket content
I have added a contextual filter Content: Assigned to, configured display based on “User ID from logged-in user”
Works fine for admin but not for other users
Can anyone please help me resolve this
The setting you're using in the view are perfectly fine. Couple of checks that you could do:
Make sure that the field assinged-to is a user reference field or an entity reference field reffering to the user entity.
Make sure there is value in the assigned-to field in some nodes for the current user you're logging in as.

Automatic calculation in a Drupal CCK field

I have a three CCK fields: Quantity, Price and Total. I would like to compute Total as a Price * Quantity. Is there any way to achieve this when the user keys in the Price or Quantity the total should be calculated automatically. I also looked upon the computed field module but this works only when I have Price and Quantity and submit the form. I also don't have an idea of applying jQuery inside CCK fields in Drupal.
Use the Computed field module for this.
Although it won't show the value on the node edit form, it will be automatically calculated and can be displayed in a view or in the node display.
Is there a particualr reason you want the total to be displayed on the node edit form? You can add some jQuery to automatically do this but you run the risk of the user changing this field or having JS disabled.
Also there is an alternative to Computed field module for D7.
Math expression fields are dynamically updated via ajax on the entity
form as soon as all necessary fields are populated. If JavaScript is
disabled, the field will be evaluated when the form is submitted. The
result is stored in the database when the form is submitted.
Math Field

Conditional field using dynamic vocabularies to custom fields on ##register

I'm following collective.examples.userdata to add some custom fields on the register form.
I want to add two fields, one for state and another for city, where the second load content based on the previously selected state.
My question is how it is possible, can do this only with the schema, using dynamic vocabularies or is need to edit registration form? How can I do it?
Another issue is how to load the registration form in a portlet. Is Possible fill the ##register viewlet?
Thanks!
Use javascript to do the dynamic part of the secondary field. To render the form inside a portlet, there are a couple of ways to do it but again, using javascript might be the easiest. You have place a register button that opens a registration overlay.
Take a look at http://plone.org/products/plone.app.jquerytools for how to wire it up.

How can I use current user (default membership) as a data field in DetailsView?

I am new to asp.net. I have a details view control on my page. I use linq to sql. My details view is an admin panel for data entry page. So some members will enter some news to my database. I want to use "Writer" Data Field to be filled automaticly with the current logged user. How can I do that?
Thanks
You will simply need to inject the username into the field at some point.
There is not a point-n-click drag-n-drop solution to this case, and there are many ways to accomplish this and to go into further detail is likely not necessary.
Just get the value into the textbox or field as the page is served where L2S can pick it up on the postback.

The GUID of the entity on a custom field

I want to create a custom textfield in a serviceactivity. When the serviceactivity onloads I would like to have the serviceactivities GUID in that textfield. Does anyone have any idea how I can solve this?
Sure.
Create a new attribute (myguid) on the entity to hold the GUID.
Go into the main form customization for that entity.
Add the new myguid field to your form.
On the form properties, alter the onLoad event.
Use crmForm.ObjectId to get the GUID value.
Example:
crmForm.all.myguid.DataValue = crmForm.ObjectId;
You might wanna check out the CRM 4.0 SDK.

Resources