Hello
how to display a currency Value in an iggrid without showing the decimal value if the decimal doesn't contain any fraction. in an MVC application.
Best Regards
Pradeep
Hello Elena,
I have tried the example you have suggested and modify the formatter for currency as per my requirement. like this
var checkthis = "$"+ val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",").toString();
and its working for me.
Thanks for your help.
Best regards
I have tried the given solution , but still i am not getting the proper solution for it. I am trying to attach the screen shot . please have a look on these screen shot.
below is the screen shot for this..
Here i am using both template, and format. so able to get the "Value" filed as required but in the "Address" field i am getting .
{ headerText: "Value", key: "PropertyValue", dataType: "number", width:"140px" ,template:"$${PropertyValue}",format:"#" },
Thanks and best regards
Hello Pradeep,
I was just wondering did you have a chance to try my sample. If you still need any assistance on the matter, please do not hesitate to ask.
Thank you for your snippets. I tested the issue that you described by modifying this sample:
http://ko.infragistics.com/products/jquery/sample/grid/column-formatter
I placed a couple of <br> tags in the formatter of the last column still on my side everything seems to be formatted as expected. Would you please check the attached sample and modify it in order to represent the issue that you mentioned so I can investigate this further.
Thanks in advance.
Thanks for your reply. Here is the code for generating the grid.
Here I have Address and purchase price column along with that i have some more column.
i don't want to show decimal value and also i want to show masking for currency.
if i Used template:$${"PurchasePrice"} then i am able to display as per my requirement but in the Address field i am not getting any new line means its displaying like this - "ADD1,Add2 <br /> City, State 900015"
function ShowPropertyGrid(data){ $.ig.loader({ scriptPath: "~/Scripts/Common/", cssPath: "~/Scripts/InfragisticsjQueryMVC/Common/CSS/structure/", resources: "igGrid.Summaries,igEditors,igGrid.Selection,igGrid.Resizing" }); $.ig.loader(function () { $("#idh4").hide(); $("#gridProperty_container").empty(); try{ $("#btnUpdate").igButton({ labelText: "Format Summaries", click: function (event) { $("#gridProperty").igGridSummaries("option", "resultTemplate", $("#resultTemplate").val()); $("#gridProperty").igGridSummaries("option", "isGridFormatter", $("#isGridFormatter").is(":checked")); $("#gridProperty").igGridSummaries("option", "defaultDecimalDisplay", $("#defaultDecimalDisplay").val()); } }) } catch(ex) { } $("#decimalDisplayRow").hide(); $("#isGridFormatter").bind({ change: function (event) { if ($(this).is(":checked")) { $("#decimalDisplayRow").hide(); } else { $("#decimalDisplayRow").show(); } } }) try{ $("#defaultDecimalDisplay").igNumericEditor({ width: 50, minValue: 0, maxValue: 10, nullText: "default" }); } catch(ex) { } $("#gridProperty").igGrid({ height: 200, columns: [ { headerText: "FKPropertyID", key: "FKPropertyID", dataType: "number",hidden:true}, { headerText: "Address", key: "Address", dataType: "string",width:"190px",format:"{0}",formatter:formatAddress}, { headerText: "Transaction", key: "TransactionType", dataType: "string",width:"120px" }, { headerText: "Property", key: "PropertyName", dataType: "string",width:"130px" }, { headerText: "Purchase Price", key: "PurchasePrice", dataType: "number" ,format: "currency" , width:"130px" },
//For this purchase price i don't want to show decimal value and also i want to show masking for currency,
// if i Used template:$${"PurchasePrice"} then i am able to display as per my requirement but in the Address field i am not getting any new line
{ headerText: "Purchase Date", key: "Pdate", dataType: "string",format:"MM/dd/yyyy" ,width:"130px"}, { headerText: "Existing Debt", key: "ExistingLoan", dataType: "string" ,format: "{$}{#}", width:"130px"}, { headerText: "Value", key: "PropertyValue", dataType: "number", width:"140px" ,format: "currency" }, { headerText: "Valuation Method", key: "ValuationMethod", dataType: "string" ,width:"140px"}, { headerText: "Loan Amount", key: "PropertyLoanAmount", dataType: "number" ,format: "currency" ,width:"120px"},//,formatter:formatCurrency ], autoGenerateColumns: false, //ClientDataSourceType(ClientDataSourceType.JSON) dataType: "JSON", dataSource: data.Records, responseDataKey: "Records", features: [ { name: "Summaries", showHeaderButton: false, showDropDownButton: false, compactRenderingMode: false, columnSettings: [ { columnKey: "PropertyValue", allowSummaries: true, summaryOperands: [ { "rowDisplayLabel": "Sum", "type": "SUM", "active": true } ] }, { columnKey: "PropertyLoanAmount", allowSummaries: true, summaryOperands: [ { "rowDisplayLabel": "Sum", "type": "SUM", "active": true,format:"currency" } ] }, {columnKey:"FKPropertyID",allowSummaries:false}, {columnKey:"PropertyName",allowSummaries:false}, { columnKey: "Address", allowSummaries: false }, { columnKey: "TransactionType", allowSummaries: false }, { columnKey: "PurchasePrice", allowSummaries: false }, { columnKey: "PurchaseDate", allowSummaries: false }, { columnKey: "Pdate", allowSummaries: false }, { columnKey: "ExistingLoan", allowSummaries: false }, { columnKey: "ValuationMethod", allowSummaries: false } ] }, { name: 'Selection', mode: 'row' }, { name : 'Resizing' } ], }); $("#gridProperty tr").dblclick(function (e) { var row = $('#gridProperty').igGridSelection('selectedRow'); var dataview = $('#gridProperty').data('igGrid').dataSource.dataView(); var cellValue = dataview[row.index]["FKPropertyID"]; _selectedPropertyId=cellValue; setgrid=1; }); $('#gridProperty_summaries_footer_row_text_container_sum_PropertyValue').remove("Sum= "); $('#gridProperty_summaries_footer_row_text_container_sum_PropertyValue').autoNumeric({ aSep: ',', aDec: '.',aSign: '$', vMax: '99999999999999.99',mDec:0 }); }); igloader=$.ig; }