Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
igGrid
posted

Hi,

 

We are using the Jquery grid at our project but we're having some problems with it.

The project is an ASP.NET MVC3 in Visual Basic. 

 

The setup for the view is like this :

@Modeltype PrijsPerProfielViewModel
@Code
    Layout = "~/Views/Shared/_Master.vbhtml"
End Code

<script type="text/javascript">
    function saveChanges2() {
        $("#grid3").igGrid("saveChanges");
        return false;
    }

    $('#grid3').live('iggridupdatingrowadded', function () { $("#grid3").igGrid("saveChanges") });

    $('#grid3').live('iggridupdatingeditrowended', function (event, ui) {
        if (ui.rowAdding == false) {
            $("#grid3").igGrid("saveChanges");
        }
    });

    $('#grid3').live('iggridupdatingrowdeleted', function () { $("#grid3").igGrid("saveChanges") });
</script>

<div class="DynamicForm">
    <h2> Prijs per profiel</h2>   
        @(Html.Infragistics().Grid(Model.TableData).ID("grid3").UpdateUrl("UpdateData").PrimaryKey("ID")             .AutoGenerateColumns(True) _
            .Columns(Sub(column)
                                       column.For(Function(x) x.Functie).HeaderText("Functie")
                               End Sub) _
           .Features(Sub(features)                      features.Paging().VisiblePageCount(5).ShowPageSizeDropDown(False).PageSize(10).PrevPageLabelText("Previous").NextgeLabelText("Next")

                 features.Selection().MouseDragSelect(True).MultipleSelection(True).Mode(SelectionMode.Row)           features.Selection().MouseDragSelect(True).MultipleSelection(True).Mode(SelectionMode.Cell)                    features.Updating().EnableDeleteRow(False).EnableAddRow(False).EditMode(GridEditMode.Cell)                                      End Sub) _

        .DataSourceUrl(Url.Action("GetData/" & Model.MainProposalData.ProposalID.ToString())) _

                         .Width("100%") _

                         .Height("350px") _

                         .DataBind() _

        .Render()

        )

        @<input type="button" onclick="saveChanges2(); return false;">Save Changes </input>

 

 

Here is the code for the viewmodel :

Public Class PrijsPerProfielViewModel

        Public Property TableData() As IQueryable(Of ProposalVolumeEnPrijsPerProfielItem)

        'bla bla more stuff that doesn't matter  

End Class

 

 

ProposalVolumeEnPrijsPerProfielItem is a class wich contains a field called ID as shown here :

    Public Class ProposalVolumeEnPrijsPerProfielItem
        Implements IHasNullableId

        <DataMember()>

        Public Property ID As Guid? Implements IHasNullableId.Id

       'bla bla more stuff that doesn't matter

  End class

 

 

Ok so the problem is that we can't edit any record, we have disabled adding and deleting of records. When the page renders the data is displayed correct but when we click a cell to edit it gives me this error in the developer tools from Chrome :

  1. Uncaught Error: In order to support update operations after a row was deleted, application should define "primaryKey" in options of igGrid.
    1. a.widget._fixPrimeig.ui.min.js:1
    2. a.widget._primeig.ui.min.js:1
    3. a.widget._startEditig.ui.min.js:1
    4. a.widget._onEvtig.ui.min.js:1
    5. a.widget._injectGrid.e._evts.clickig.ui.min.js:1
    6. c.event.add.h.handle.o
       
       

The error looks self explaining,adding a PK but that is taken care of as you can see in the view. Besides the error nothing happens, my actions in the controller aren't executed or anything.

The things i've tried are :

- checking script references (compared them to samples from Infragistics blogs)
- Checking that there is no empty data passed from controller to view
- Compared my code to example code from the site
- Abused google :p
- Searched the forum here 

 

So im kinda out of idea's here, hope someone here can help :).

If you need more info just ask.

 

PS sorry for the poor formatting!

 

Fabrizio

Parents Reply Children
No Data