Is there a way to merge two data in one row?
I have a gridview, within it, there are products that can be sold as a bundle. If I have it as it is right now, the user can delete one of the product bundle, and still receive a bundle price. That's not good. So how can I merge the two rows into one?
Or is it possible to add a row that indicates that the following two rows are a bundle? See picture, where there's an extra row. My other thoughts are having a cgridview in a cgridview?
My database has a column that indicates whether the product is a bundle or not. Let me know if there are any information needed.
you can also use CListView for custom view and also having filters and sorts.
for creating custom html based on dataproviders, I think it's the best solution, since you only care about the layout and yii provides the data.
You are over complicating things I believe. Why not just create the html yourself? that would be the easiest solution by far.
If you really want to do what you want then you have to extend cgridview and create some rendering yourself.
If you really want to go that route then try to study this http://yiibooster.clevertech.biz/extendedGridView#groupgridview some of the features are almost exactly what you need.
Related
I have a table [contractor c] in which only one field [tin] may be edited. If the user tries to change data in other field it shall not be updated. Was wondering if making a view of the c before editing and then comparing the view with edited table is a good idea. But that would require two scripts- before and after update.
I could also make a validation on every single field except tin, but there is 'a lot' of fields.
Looking for the best and most optimal way to approach this task.
This is too long for a comment. There are many ways to do what you describe. "Views" are not one of them. In SQL, a view is a stored query. It does not store values. That is definitely not going to help, because the view changes with the underlying tables.
If only one column can be updated, then one method is to implement a trigger that checks the before- and after- versions of the record and only allows updates when no other fields change.
You can start learning about triggers in the documentation.
An alternative mechanism is to make the table unupdatable except for update permissions on a single column. You can learn about permissions in the documentation.
If for some reason you wanted to do all the work in the application, then transactions might come into use. You would not commit the transaction until the update meets your requirement. Transactions are explained in the documentation.
I want to create an on-demand process of some kind in Dynamics CRM 2013 that will run on multiple records of the same type. The process will create an equal number of records of another type, and all will relate to the same parent record. I can imagine how a workflow would be used to create the new child records but I am not sure how I could create the parent record and associate it with the child records.
If you're running on multiple records, then I presume your are starting from a gridview of some sort. If that's the case, then the solution is easy. Just create a custom ribbon button that accepts the selected records as a parameter, and runs a custom javascript. That will accomplish what you need in a nice elegant solution.
Because it's running javascript, you will have full control to be able to do everything you need. One of the features of ribbon buttons, is they can receive the selected records in a parameter as an array.
But if you don't want to do all the work in javascript, you can have the script pass the parameters to a custom Workflow or Action.
As its already been mentioned, a workflow won't be able to do this alone, because it can only run on a single record, and cannot accept multiple records as an input parameter.
Jason I think the point here is to automate the process. Lee you are correct in your assessment that creating the work order with a workflow step is easy to do while creating the child work order items is either difficult or impossible. Even if you managed to hack this together with several workflows triggered by different events during the process the end result would be a UX/maintenance nightmare.
The simplest and best solution is to have piece of plugin logic that you trigger with your workflow. This plugin code would create a new work order and associated work order items based on the context of the service you run the workflow against. If you would like for this action to be triggered by a database operation instead of manually triggered this would be simple to do as well.
You aren't going to be able to do this via a CRM dialog because it can only run against one record. You can accomplish this fairly easily by leveraging existing CRM functionality:
If it doesn't already exist, create a field in your service entity (the Work Order Item) called new_MasterWorkOrder (or something similar) which is link to a Master Work Order entity.
Create your master record - this would be your Overall Work Order.
From your Work Order Item record entry listing, select all the items you want to add to the Master Work Order record created in the previous step. Alternately, you could use an Advanced Find to locate the target records.
Click the Edit button to initiate the CRM bulk/multi-record edit form.
In the new_MasterWorkOrder field, select the Overall Work Order previously created.
Save.
Once the process complete, all of the Work Order Items you selected will now be linked to your Overall Work Order.
It sounds like you might a need a step before this to create a Work Order Item from selected Service entities. You should be able to accomplish this easily by having a workflow which runs takes in a Service entity as a parameter and builds a Work Order Item from it. Once you have these built you can link them to an Overall Work Order using the process above.
I want to create a record of an entity, but I need to pass a list of guids to the pre create plugin. I don't want to create fields or related entities to do this. Can I use the Shared Variables to do it?
In other words is it possible to set shared variables before initiating the action that will trigger the plugins that will consume them?
EDIT:
I can be creating this type of records from different points that integrate with crm, silverlight, external pages or even plugins of other entities. My current problem can be solved with a field on the entity, but this way if I had to send parameters to control the execution of the plugin for two or more independent actions I would need one field for each action or instead use only one field using a complex format/parse pattern to parameterize each different action. Using fields to accomplish this feature looks a bit excessive.
If the shared variables could be set before the call of the action that will trigger the plugin that would solve the problem and I wouldn't have to create fields in the crm database, because the data I want to pass to the plugin it will only be needed at that time, like a parameter in a function, no need to persist them in the database.
But if it is not possible I will have to stick with the fields :(
Not if they vary by entity/execution of the plugin.
Options:
Set them in the plugin configuration if they don't change but need to be updated
without a recompile.
Apply them as a delimited string in a single field on the entity if they vary per record.
What's the reason for not wanting to use 2?
Nope. The easiest solution that I can think of is to add a BAT (big-ass text) field to the entity and populate it with a comma-delimited list of GUIDs, then access that field in your Create plugin. You could even clear it out if you don't want that extra data in your system.
Edit after your edit:
General comment about your thinking process: you are probably overthinking it. :) Using a single field, you could pass in any kind of "command" using a json or xml formatted string. As I said above, in the pre-create plugin, after you have extracted this "argument" field, you can clear out that field in the Target entity image and that data will never be persisted to the database. Technically it achieves the exact result you want with the only side effect being one extra "argument" field that is always NULL in the database. Don't fight simplicity so hard! :)
I want to make a table of "people", where each of their attributes is inline editable. There are about 500 people, and the list will grow over time. The people#index page contains this list.
Since there are a lot of form elements, the server takes a long time to render the page. The server I'm using to host is also fairly slow, so I thought about making the Javascript doing the rendering of these tables.
Currently, I created a new action to return JSON data of all the people's attributes, and I use Rails to generate just a template for the row. I then use jQuery to clone that template, and insert each attribute from the JSON data into a new copy, and add it to the rows.
This makes people#index load a lot faster, but now I run into the problem of the Javascript freezing up the page for a second while things load.
I looked into web workers for creating a thread to do this work. I plan to generate the extra rows on a separate thread, then add it to my table (I'm using dataTables).
I feel like I might be missing something. That this is a sloppy solution.
My question is, is there a better approach to this?
Possible options:
1 Pagination
I this in this case pagination is the best solution.
Pagination can be done on rails side(https://github.com/mislav/will_paginate and https://github.com/amatsuda/kaminari gems) or on js side.
2 You may also use something like http://trirand.com/blog/jqgrid/jqgrid.html
This JS component offers ability to inline edit data too and you may search for rails integration gems like https://github.com/allen13/rails-asset-jqgrid
I'm looking for a rails gem (or possibly several together) that will be the basis of the user facing front end for my application.
I'm constraint by a few things -
First, my user base is very technically challenged. All of the UI pieces have to be very easy to understand (in other words they've been seen a lot). It will be a stretch for these users to click on a column header and expect it to sort without some kind of prompting.
Second, the application flow needs to be very simple. As I mentioned in the first condition if I spread this out into a lot of small actions I'm likely to loose my user.
The core of the problem is that I have a dataset with 15 columns. I'd like to have the ability to:
have the users dynamically select which columns to view at one time
sort on any column in the view
filter the results (via text and attribute search)
pagination
I don't need any editing capabilities.
I've googled around for "ruby on rails datagrid" without much luck. I'm developing on Rails 3.1. Thank you for any help!
Check out the rails-casts on doing this with using the will_paginate gem and some sorting code: http://railscasts.com/episodes/240-search-sort-paginate-with-ajax and http://railscasts.com/episodes/228-sortable-table-columns
I'd take a look at DataTables. It's a JS table and there are some ruby gems that wrap it, e.g.: jquery-datatables-rails. There is also a railscast about it.
Try Datagrid - ruby library that helps you to build and represent table-like data with:
Customizable filtering
Columns
Sort order
Localization
Export to CSV