jqGrid, set initial value for a dynamic dropdown inline edit - jqgrid

jqGrid.js v5.3.2
Hi all,
I have been trying to figure out a way for 10 hrs for below situation:
the grid is set to inline edit.
there are two dropdown/selects. ddl1 and ddl2
the options list of ddl2 depends on the value of ddl1. This means each row may have different options.
I have been able to dynamically populate/select/save ddl2 based on ddl2's initial Key value or the selected value of ddl1 during
Editing by setting dataUrl of ddl2 and "change" of dataEvents on
ddl1 (column).
I want to display the Value(not the Key) of ddl2 initially. is there a way I can set a row's "formatter"'s "value" property dynamically in
loadComplete? I forcefully set the html content of the "td"/cell
during loadComplete but the content wont survive a round of
Edit/Restore.
TIA

Related

slick grid - unheck all rows for paging, sorting and search events

I am using SlickGrid with the checkbox selector plugin and the pagination plugin. I want to only allow the user to select rows for the current page. I noticed that slickgrid remembers values that the user selects on a previous page. Only when a user selects a row on the current page does it uncheck the rows on a previous page. Is it possible to uncheck all rows on a page change event.
Similarly if the user does a search I want to unselect all rows.
Same with sorting, unselect all rows for the grid when the user does a sort.
Is it possible to do this?
The checkbox selector plugin was not designed for pager. Whenever you set checkbox as selected using the plugin, it remembers the row indices _selectedRowsLookup of the grid and re-apply the formatting when the grid invalidates. Thus, it will be the same rows check/unchecked on each page.
To achieve what you want, you have to customize the plugin where you need to:
Add a flag/field isSelected to your dataset that store if a record is selected
Set the formatter to check the dataContext.isSelected instead of using the _selectedRowsLookup
Change the handleSelectedRowsChanged to modify the field isSelected to true or false with the correct reference on the current page.
To select the rows of current page, change handleHeaderClick to only modify the rows displayed using the current pagingInfo
To clear the selection, reset the isSelected field to false and invalidate the grid rows.

Jqgrid - How to create a custom add-button that you can supply of parameters

When you create a jqgrid there is a default button on the bottom of the grid that allows you to create new records.
However, when you open the modal, all input fields are empty.
In my situation I need this button, but I also need the exact same thing but with the possibilty of adding a few parameters so some of the fields are already filled in. The parameters would come from the selected row at that moment.
Like when I click a row where the date is set to 01/01/2099 i need the add-modal to open with the date already set to that date.
You can use beforeShowForm or afterShowForm to make any changes in the Add Form during opening. For example you can read the values from currently selected row and fill some fields of the form with new values. To be open Add form on click or double-click on the row you need just call editGridRow inside of onSelectRow/ondblClickRow callback.

Datatable editable - make cell editable based on a condition

I am using Jquery Datatable Editable. I wanted to know if it is possible to make a cell editable based on a condition.
For example if my data is rendered this way,
Key text
1 Help
2 Choice
3 Edit
Key and Text are 2 columns, I want to make the cell with value choice only editable and the cells with value Help and Edit remain readonly. Is it possible to achieve this via Datatable editable ?
You may use jEditable js to make a particular class editable. Click HERE.

Xpages - CompositeData - Repeat Control

I have a repeat control, repeatControls = false, rendered = true, using both indexVar and var. Value is an array from a sessionScope variable, so if 4 values, 4 items are shown.
Printing Computed Fields isn't an issue
I added an Edit Box inside repeat and set it to bind data using compositeData.editField1
no Partial refreshes
Then there is a button which has to set the data of all rows of editable fields to a sessionScope variable,
if I just do
sessionScope.put("editField1", compositeData.editField1), I just get the value of the last row. how to add the values of the other rows of edtitable fields ? There are no bindings to Notes views or documents as they aren't needed. Thanks
If you have input fields, you need to bind them. Binding them to a scope is perfectly fine. In the same question Michael was pointing to is the link to a sample with add/remove row logic (just substract the part where it goes back to the field).
Excercise 23 has all you need.

jQgrid multiselect with dynamic changed cell value based on dropdown selection

I just found that sample
http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect2.htm
I want to have something similar:
I want to be able to post selected values on server and also i want to have a dropdown and based on that dropdown selection another cell value of that row gettign changed
How can i do that?
|Id|Dropdown|ValueChangedOnDropdownChanged|
1 A[A/B] A selected
2 B[A/B] B selected
*[A/B] it is dropdown options
I am not sure that I understand your question correct. The demo which you reference in your question I created before for the answer and this one.
Look at the another old demo. It shows how to implement dependent select (dropdown) list. The demo shows how to it in inline editing, form editing and the searching toolbar. In case of the usage of server base data you will have to use dataUrl and buildSelect to implementation of the same behavior. The dataUrl should be used instead of the v property of the searchoptions or editoptions. The buildSelect can be used ton only to modify the server response, but just as the good place to rebuild the dependent select (dropdown list).

Resources