jqGrid Form Editing with drop downs - how to set initial value - javascript

i have an object with 3 values
ID
Abbreviation
Description
in the jqGrid I set the grid up to display the Abbreviation.
when I click to edit (using the Form Edit feature) I fill the drop down with the ID/Description combination of values via the edit options:
editoptions: { value: "ID1:Description1;ID2:Description2;...;IDN:DescriptionN" }
how can I easily set the selected value in the drop down list, when all I have available to me in the grid is the Abbreviation?

jqGrid will default a select list to the value in the grid if it can find it, though this obviously doesn't help in your case because the only data jqGrid has to work with is the abbreviation and it's trying to match it to the ID in your select list.
I think the only way you can do this is to include the ID in your grid's colModel as a hidden field. Something like
{name:'ID', hidden:true...}
Then to set the select list to the proper item you need to hook into the beforeShowForm event and use the hidden ID from the currently selected row to set which of your select options is selected by default.
Good luck!

There's an example buried in the jqGrid forums, you can set the DataURL tag to a text file that contains a select statement. Since it accepts a well formatted select you should be able to set a default.

Related

Vue- How can I control the behavior of chips in v-autocomplete?

I have a 20-25 names coming from API where I'll need to show them in a drop down box (requirement). I'm using Vue v-autocomplete here to display the selected names on the field. I've used custom item called Select All where the user can select all the names in the drop down list, but what I also need to do when the user clicks on Select All is that I don't want to show all the names in the Autocomplete field including Select All Chip. Only items that are selected individually without Select All should show as Chips.
Here is my code sandbox I've attempted so far. I'm new to Vue js, so I'm hoping to get some thoughts on controlling the chips on v-autocomplete.
v-autocomplete sandbox
Instead of including "Select All" in the array of names, you can use the prepend-item slot to include a separate Select All checkbox.
If you need to differentiate between names selected via individual click and those selected via the Select All checkbox you will probably need a new property in the names array to track that, say a boolean that is true if selected one way and false the other.
You'll also need a slot like selection to customize the display of your chips where you can use v-if to conditionally render a chip based on that new boolean property.
This codesandbox I believe is pretty close to what you're after

Dynatable.js - generate select dropdown filter from values in table

I'm currently using dynatable.js to generate a searchable/sortable table from a JSON file. Sorting and searching is working so far. However, as far as I can tell/find, a select dropdown for filtering must have the options manually created in the HTML of the table. I need to instead generate the options for the filter from the specific column.
Example:
The Gender column should be filter able by male and female. This example is fine to add the options directly in HTML as they will be the only options to exist. However, the 'course' column will change over time as courses are added and removed and fed to the table via ajax. The filter options for the column should be generated by the available values in the column.
Is this possible with dynatable as a feature? If not (I can't find it anywhere), how can this select dropdown by generated from the array being used to populate the column.

sap.m.select values not selecting correclty

I have a sap.m.inputlistitem with content as sap.m.select.
The list and select are binded to a JSON model.
The list is rendered with select(dropdown) values properly but the problem is......
when I select another element than default value in dropdown/select ,the value is not getting selected ,
ex:
lets say i had a dropdown with 3 values / 3 select options
sapui5
backbone
angualrjs
now, when i select backbone, from dropdown list ,its selected ,but when i want to select sapui5 again its not selected...
any ideas ????
sap.m.inputlistitem should not be a valid aggregation type for items aggregation of sap.m.Select.
UI5 Document for Select
Aggregations
items (default aggregation) : sap.ui.core.Item[]

Updating gridview's drop down lists using JavaScript?

I have a gridview with several fields. Fields in question are PreviousPoints, GainedPoints, TotalPoints. In the edit mode PreviousPoints is not editable, just data bind, GainedPoints is a drop down list and Total Points is a Drop Down List.
When GainedPoints drop down list selected value changes, I need the TotalPoint selected value to be set to the value of PreviousPoints control + GainedPoints selected value.
But, I cannot refresh the whole page using post back.
How can it be done using JavaScript or something similar without reloading the page?
you can use the onselect() function in javascript and have your computations there.

Display Some Lables in Jqgrid add/edit form

I want to add some label in my Jqgrid form in ADD mode....so is there any way to add some text which is not belong to any Control of the form
so what should I written for this funcnality...does it possible or not?
please show me some example regarding this
Thankyou
One way around the problem is to use your own editing form, instead of the one built into jqGrid. You will have full control over the form content, but at the price of having to write the code specifically for your application.
Alternatively, you can specify Form Options for any column which can add text or HTML content before or after a field, as well as other options. For example:
colModel: [
...
{name:'price', ...,
formoptions:{elmprefix:'(*)', rowpos:1, colpos:2....},
editable:true },
...
]
The options you may be most interested in are:
elmprefix - string - If set, a text or html content appears before the input element
elmsuffix - string - If set, a text or html content appears after the input element
Although these options are specified for each column, you might be able to make some creative use of this to make it appear a label does not belong to a column. For example, by inserting HTML <br /> elements or such.

Categories

Resources