This is a migrated thread and some comments may be shown as answers.

How do I navigate user from edit form to grid row they were last viewing?

1 Answer 10 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 30 Jan 2014, 04:43 PM
Can't find an example of how to do this.  Scenario: user navigates to the third level of a hierarchal grid and clicks the Edit link, taking them to the Edit View.  When complete, the requirement is to return them to the grid row they were formerly viewing.  Sample project is attached.  Please note, I had to delete most of the project folders, especially the scripts to get the zipped size under your 2MB upload limit.

Two more questions relevant to the same project; 

1) I want to show the various levels of the hierarchical grid in different colors and also to vertically align all cells in all grids to the the top of the row.  I'm sure CSS is the right way to do this, but what is the best practice for how to do it?  What elements must I reference in the CSS?

2) How do I suppress a value in a cell?  I have a default date that comes in as 01/01/0001 12:00 AM which for my purposes is an invalid date.  When I see this value I want to suppress the display and show a null string instead.

Thanks!

Rich

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 03 Feb 2014, 05:07 PM
Hi Rich,

Although not supported out of the box this behavior could be achieved using a custom solution. For example you could:
  1. Pass the IDs of expanded Grid rows to the View 
  2. Use the dataBound event of the parent Grid to expand the first child  
  3. Apply the same steps to each level until you reach the desired Grid

Regarding your second question - you could use the dataBound event again, this time to add a class to the child Grid's wrapper. For example: 
@(Html.Kendo().Grid<kendoBatchHeaderTest.Models.Transaction>()
            .Name("TranGrid_#=BatchID#")
            .Events(events => events.DataBound("dataBoundTransaction"))
            ...
)
<script type="text/javascript">
    function dataBoundTransaction() {
        this.wrapper.addClass("transaction");
    }
</script>
<style>
    .transaction {
        background-color: red;
    }
    .transaction .k-alt{
        background-color: red;
    }
</style>

Regarding your third question - I would recommend using templates. Kendo UI Templates support JavaScript, so you could build some custom logic there.

Regards,
Alexander Popov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or