I'm facing a issue that I need to call a javascrip function when the user select any row of a SubGrid.
Scenario:
I have two grids, the first one shows accounts records, the second one is supposed to show all the Phones related with the account record that I selected on the first grid.
Is that possible?
Thanks in Advance
CRM Javascipt SDK doesn't support any of those features. You should probably have a custom ribbon button to handle it. Or you can use jquery to attach some events on the record dom. But, this is not supported by CRM 2011.
Related
Would it be possible to use a popup form to handle parameters for a custom menu item in a spreadsheet? I'm not necessarily asking for someone to write the script. I just don't want to try only to discover I've been wasting my time.
In my spreadsheet, I want to be able to save a sheet to a new file/spreadsheet (that part is done) and then access/load that saved sheet again later through a custom menu command. The issue I'm running into is that I want to be able to call the same function every time, but be able to specify a parameter (which sheet to access). My thought is that the form would act like an alert with multiple choices populated by the array of available sheets.
Or is there a simpler way to offer a multiple choice without going through a series of YES/NO alerts?
Yes. You can use dialogs.
modeless dialogs
modal dialogs
Dialog Example
Good Evening to all,
I'm currently developing an app that fetch data from a DB via AJAX calling a .php file.
I've got a table with 4 columns, the first 2 columns contain a < select >, the third an input and the last a button.
The first row is static: i've got a php query that loads the information of the 1st,2nd and 3rd column with default values.
When the user choose change the value of the 1st select a trigger launch a Jquery function that drop-down update the content of the 2nd and 3rd column.
In the same way if the user change the value of only the 2nd column, only the 3rd column value will be drop-down updated.
If the user make changes only with the 1st row, the code has no problem, but if the user press the button and via an .append() the code add another row, with the same scripts as the 1st one, obliviusly the new row selects won't work.
Trying to fix this I created a php for that copies the Jquery change functions using the iterator as identifier for both functions and the rows of the table.
Using the code inspector of chrome I don't find any errors, but only the 1st row jquery select will work, that is strange considerated that the 1st row function is generated by the same php cicle that is used for the others.
The hair are falling of my head because of this problem, hope you can understand and help me.
Thank in advance
Events and handlers added to existing elements won't work on clones of those elements added later dynamically. Simply said, your functions to do stuff on drop-down etc on existing rows are limited to those only, and won't apply to any newly generated rows.
For a general solution, consider writing all the event handlers separately, and invoke those again when you add new rows on button click.
Hope this made sense!
Hi I'm writing a web app using rails and as part of it I am displaying data to the user using jQuery Bootgrid. As part of this the user is able to set the number of rows per page of the table. I'd like to be able to have this setting persist between page loads.
When a user chooses an option for the number of rows to display I am able to capture that and store in a model. However Bootgrid doesn't seem to have a simple way of programmatically setting the number of rows. This seems like a common thing to want to do so if anyone has come across this before and can give some help it would be greatly appropriated.
you can find a "setRowCount" implemented in
https://github.com/rstaib/jquery-bootgrid/issues/215 - jquery.bootgrid.modified.txt
Unfortunately the user didn't see fit to properly fork the repo.
Not my best code but it is working:
With jquery fire click event of number of rows that you want...
$("#grid-basic1-header .dropdown:visible [data-action='-1']").click();
I have a grid which users can add products too
I have a plugin that executed when there is a update to the record, however when a product is added the plugin/CRM doesn't recognise that as a update to the record therefore the plugin doesn't execute.
Is there a OnChange function I can access through JavaScript for the Grid so that I can change the value of a hidden field so that then a change has been made to the record, therefore a update being recognised and the plugin being executed?
Thanks
No, there is a no SDK function to add a JavaScript event when an item is added to a grid is CRM 2011/2013.
The correct way to handle this requirement is in a plug-in.
Records appear in a grid when they are related to the parent record - either a one-to-many relationship or as a many-to-many relationship.
If it is a one-to-many relationship you can trigger on the Create and Update of the many side (since it will contain a reference to the one side.) If it is a many-to-many you'll need to trigger on Association as shown here in a previous question.
One way to handle this situation would be add a on-create plugin for the Products - which can trigger the On Change plugin for the record in the similar fashion as you are trying to.
Essentially, oncreate plugin will update the record which will fire the on update plugin of the record. This would be the case if the relationship is 1:N
If its a N:N relationship, then the plugin should be registered on Associate / Diassociate, not on create / update.
In fact, the question is not clear, hence the two options above.
I'm trying to be able to retreieve the selection of a SubGrid at the exact moment a user selects it. For example, add an EventListener OnClick that would make a JS function run in the background to do X thing when a subgrid element/row is selected without having to click Save or another button to run the function. Ive been searching online and alot of links appear for retrieving ALL records in a subgrid but none really show if one can add an EventListener. Another possibility would be to intercept when a subgrid is focused on and make that run a function. What do you guys think would be possible, always trying to keep the methods the supported way. :).
If your willing to be a little creative, you could try the following:
Add a custom ribbon button.
Add an enable rule to that ribbon button that calls a JavaScript library.
Add your logic into that JavaScript library.
When a record is selected in the sub grid, CRM will refresh the ribbon and call your enable rule.
I've only just thought of that so I don't know if it will work, but worth a try.
If that fails then I don't know any other supported way to have an OnClick event.
Edit, I've had a play and it does appear to be possible, see my blog post here: CRM 2013 Adding an On Change Event to a Grid View. Its for CRM 2013, but I believe can be adapted for CRM 2011 (see my note at the end).