serenity-is / Serenity

Business Apps Made Simple with Asp.Net Core MVC / TypeScript
https://serenity.is
MIT License
2.61k stars 802 forks source link

get field value in typescipt #711

Closed Nathan2020-0126 closed 8 years ago

Nathan2020-0126 commented 8 years ago

I want to get the value of filed 'CustomerFax', but it always show the field name,'CustomerFax'. How to get the 'CustomerFax' field value?

getToolbarButtons() { var buttons = super.getToolbarButtons(); alert(OrderRow.Fields.CustomerFax) buttons.push(WujP_Andon.Common.ReportHelper.createToolButton({ title: 'Invoice', cssClass: 'export-pdf-button', reportKey: 'Northwind.OrderDetail', getParams: () => ({ OrderID: this.get_entityId() }) })); return buttons; }

volkanceylan commented 8 years ago

First of all, you can't get any field value in getToolbarButtons(), entity is not available there yet. And the thing you alert is a field name, not a form field.

You can get in in a click handler though, using this.form.CustomerFax.value.

ReportHelper.createToolButton({
    title: ...,
    ....
    getParams: () => ({
         someFaxParam: this.form.CustomerFax.value
    })
});
Nathan2020-0126 commented 8 years ago

I don't understand. I want to set the button title based on field value. Is there any sample?

volkanceylan commented 8 years ago

No

volkanceylan commented 8 years ago

Find button with jQuery and change contents, thats only option.

Nathan2020-0126 commented 8 years ago

Thank you, I work it, just as you said.