Closed Methraen closed 4 years ago
Hello @Methraen
now it is not possible to simple retrieve all modified rows. You can use some events which FlexGrid provides for handling new added rows NewItemCreated
and after modification of item SaveOperationFinished
. Sou you can track these changes by your own. Maybe I will consider some imporovments and public API for retrieving changed rows or all list. But for grid which is not LazyLoaded this scenarion does not make sense.
Edit fields for columns can be changed when you create your own renderer tree class by deriving AbstractEditInputRenderer
and resigster into DI container after FlexGrid is registerd. You can check how EditInputRendererTree
is implenteed and you can use similar approach. It design by desing pattern chain of responsibility. You can also use defined input types and create just your special cases and only create the tree of resnposibilites by your own. If this API is not suitable for your scenario you can made some changes and send me PR and we can discuss about changes.
I hope that answers will help you :)
@Methraen
also for columns edit inputs you can use. https://github.com/Mewriick/Blazor.FlexGrid/wiki/Custom-components-in-column
If you have only one specific column this is better API for your problem
@Mewriick Thank you for your answer, im gonna take a look at this
@Methraen
if something will not be clear to you do not hesitate to ask, I will accoring to your questions update documentation.
@Mewriick This is really nice thank you, just one question at the moment in the wiki you linked me higher, where does this 'BindMethods' come from ?
@Methraen
Yeah BindMethods
are not available now because this is no more exists in Blazor. Now you have to use EventCallback.Factory.Create
.
For example:
.AddAttribute(HtmlJSEvents.OnChange, EventCallback.Factory.Create(this,
(ChangeEventArgs e) =>
{
FilterValueChanged(BindConverterExtensions.ConvertTo(e.Value, string.Empty));
}))
@Methraen
I updated wiki page thanks!
@Mewriick Any idea why when i change the editing input of a column, the values of this field only, are not changing after pressing the save button ?
@Methraen
Do you call method NotifyValueHasChanged
with the new value on EditColumnContext
object?
Func<EditColumnContext,` RenderFragment<TestDto>> TestDtoRemunEdit =
context =>
{
RenderFragment<TestDto> remunEdit = (TestDto test) => delegate (RenderTreeBuilder rendererTreeBuilder)
{
var internalBuilder = new BlazorRendererTreeBuilder(rendererTreeBuilder);
internalBuilder
.OpenElement(HtmlTagNames.Div, "edit-field-wrapper")
.OpenElement(HtmlTagNames.Input, "edit-text-field")
.AddAttribute(HtmlAttributes.Type, HtmlAttributes.TypeNumber)
.AddAttribute(HtmlAttributes.Value, test.RemunerationAnuBru)
.AddAttribute(HtmlJSEvents.OnChange, EventCallback.Factory.Create(this,
(ChangeEventArgs e) =>
{
context.NotifyValueHasChanged($"{BindConverterExtensions.ConvertTo(e.Value, 0)}_CustomEdit");
})
)
.CloseElement()
.CloseElement();
};
return remunEdit;
};
@Methraen
Here the problem probably is that you have value which is int
and in NotifyValueHasChanged
you convert value into string
and internally setter method for property try to convert into int
this value and this will fail.
Change to
context.NotifyValueHasChanged(BindConverterExtensions.ConvertTo(e.Value, 0));
This is it, thank you ! The last thing i need to do is to get the full list of object when i save a row, i'll take a look on that part probably tomorrow. Anyway thank you again for your help and your time !
@Methraen
If you save the row saved object is provided by SaveOperationFinished
event args
<GridView DataAdapter="@dataAdapter" PageSize="250" SaveOperationFinished="Save"></GridView>
@code{
TestDto Save<SaveResultArgs>()
{
return null;
}
}
Something like that ? It asks for Action\<SaveResultArgs> Maybe worth doing a little doc about it too ?
@Methraen
for example
@code{
public void ItemSavedOperationFinished(SaveResultArgs saveResultArgs)
{
Console.WriteLine($"Item saved result: {saveResultArgs.ItemSucessfullySaved}");
}
}
I think this is straight forward event consuming. I will add this on wiki
Thank you for the example, it took me about 5 minutes to find the using for SaveResultArgs : @using Blazor.FlexGrid.Components.Events
but now it works.
So with this SaveResultArgs i can get the modified object right ?
It's ok, i found it, thank you anyway you helped me a lot!
Please consider making a function that gets the full list of modified object as we gave it to the grid at the beginning.
Hello, i started using your package aproximatively a week ago, it is very powerful but i dont see some of the things i need in your documentation as how to get back the list of object after inserting it into the grid, and how to change the edit input on a column. I see in Blazor.FlexGrid.Components.Renderers.EditInputs a list of inputs premade and i try to use them but i cant no matter what i try, could you help me pls ?