Display Some Lables in Jqgrid add/edit form - javascript

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.

Related

When a datatable (jquery) has data after getting filtered, make a label visible

I have a DataTable (jQuery) that currently allows me to filter my data when I enter a string inside an input field. By default, a label is invisible.
After filtering, I want to be able to make a the label visible if the the dataTable after filtering contains data. Vice versa, if the dataTable is empty after filtering, I want the label to stay invisible.
I am relatively new to web-development so please excuse my lack of knowledge. The filtering of the datatables is client-side so im a but unsure on how to achieve this.
this is how i initialised the datatable
if the filter results in an empty dataTable, no label should appear
if the filter results in a datatable with data, a label should appear
You need to add a change event listener
to your input field. Afterwards just check if the field content meets the required conditions and set the label's display style to style properties like
document.getElementById(labelname).style.display = 'none'

How to apply Formatted Mask to a input filed

I want to apply Formatted Mask to my input box. Here I have jsFidle for Doller currency, But instead of doller I need to change Soles(S/.), For that I have overriden the $locale.
this is the code i have overiden in jsfidle.
$locale.NUMBER_FORMATS.CURRENCY_SYM = S/.
Soles symbol is visible but while entering number amount there is a problem.
Here is the fidel. I dont know how to post fidle link. There is condition to post jsfidle. Here I am posting url. Please find it. http://jsfiddle.net/ExpertSystem/xKrYp/
UPDATE:-
My requirement is I want a soles symbole before my value that is I achieved through annoop answer.Even ng-model is not effecting for the first time,But The problem I am facing with that is if I edit the existing value it is effecting to my ng-model.
My second problem is I am having two text boxes.In one text box I need to show doller and second I need to show soles symbol. If I apply this script in my jsp page I am only getting soles, Not soles. If I Remove that script from jsp I am getting only soles not doller.
<script src="//code.angularjs.org/1.5.4/i18n/angular-locale_es-pe.js"></script>
You don't need to override, just include the necessary locale and then try.
See this fiddle. I've tried with different directive, hope it helps :)
Include locale :
<script src="//code.angularjs.org/1.5.4/i18n/angular-locale_es-pe.js"></script>
Updated Fiddler link.

Jqxdatatable : keep or recover the original names of an HTML table of inputs

I'm new with jqwidgets
I have an html table in a form and the cells of this table are of inputs type
the html is constructed in Java via a JSP
These inputs in the table are submitted by this form when a button is pressed
(all fields are submitted with a specific name)
http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdatatable/index.htm
I am using jqxDataTable plugin to easily replace and customize this HTML Table already constructed on my page
and it works well, the right value is in the right cell
but i lost the name of the input
jqxDataTable transforms the inputs in the cell in a simple div
and consequently, removes the name of this input, and it is a problem for the submission...
i use a cellsrendrer,
so i can put a new input in the cells of my table
but i need to recover the old name and the old id of the input (in the previous HTML table)
in order to associate to the new input in the new table (Jqx) and to be able to submit it with the right name
Is it possible to do this ?
Your help is much appreciated. Thanks.
I finally find a way to answer to this problem
i use jqxgrid instead of jqxdatatable
and i follow this demo example :
http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm#demos/jqxgrid/loadfromtable.htm
so I create an array of row-objects with the input names
during the loop
as it is done in data for the array of data
and then I use this new array in the cell renderer with an input

How can i get Knockout to generate new HTML that has bindings

I have created a form with knockout that will allow the ability to give a product dynamic attributes: (i.e. size - small, med, lg). This is generated by input field and a multi select drop down.
When the fields have been filled out and the selection list which is the attribute values has been generated, I can add them to an observable attribute array.
The problem I can't see is I need to display these attributes and their array of values, but I also need them to be editable. I wasn't so keen on the idea of them be reloaded into the main form where it was created - but maybe that is the best way.
Maybe just listing the attributes as uneditable list of attributes
example:
Name: <span data-bind="text: attributeName"></span> <select height="5" data-bind="options: attributesValues"> <button data-bind="click: edit">Edit</button>
And if they click edit it loads it into the form that they created it from so it can be edited.
However, I wanted to see if there is a way to do inline editing and bind to the added Attributes and each of their array of attributeValues. So when they remove an attributeValue from the list, it would remove it from the array of that particular attribute.
Any thoughts?
So, I am not too confident I understood exactly what you are trying to do, and the one line of code you posted didn't really clarify it. I threw this fiddle together that has a multi-select for attributes, and lets you add new products with the select attributes. Once added, the new product has those attributes as select's of there own, which can still be edited. If this isn't what you are after, please try to clarify, and maybe post some more code.
Here is the fiddle

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

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.

Categories

Resources