Sort functionality in Data Grid

Hi Gurus,
I am new to this DataGrid control.I want to establish the sort functionality when clicking on the headercolumns as in matrices.
(ie.When double clicking the header column , sort the data in ascending or descending order of that column) like in system form matrices.
How ever this is not possible when I tried with grid control.
The problem I am facing is that I cannot get the column headers of the grid programmatically.(in duble click event or itempressed event)
Anybody did this one previously? Also how
we can change the column order of the grid using screen painter?
The columns that actually come visible in the grid  are actually columns of the linked datatable object.
In the designer ,there is no "swap" button for column re-ordering.
Only one way I know is changing the query associated with datatable.
This is a crucial thing ,since client may ask for re-ordering of columns frequently.
Can anybody help?
Regards,
Deepesh

Hi Deepesh,
1. This functionality is not available with the SDK. Thus it's not possible to change it on the fly. Your only option is to change the query associated with datatable (as you mentioned). You may set up a user preference table, that the user can configure with its preference. That's the best you can do.
2. To swap the columns in screen painter you must use SBO 2005 (it's not available on previous release). What you must do is, click on the one column you want to swap and the other you want to swap and click on the swap button (on the left bottom of the page in the columns tab)

Similar Messages

  • How does the SORT function in ALV grid work?

    Hi,
    I have a report for which the o/p is displayed in ALV grid format.There is one column in the O/p strcuture which is "No of days".Based on certain conditions,i need to display the value for some of the days as Negative e.g. " - 45".Becasuse of this,I have declared the field for the "No of days" of the type "CHAR".
    Now when i sort(using ALV grid SORT function) the list on basis of this column,it doesnt give me the correct o/p.
    CAN anyone tell me how do i handle this?I want the list to be sorted correctly on basis of the "No of days" column.
    Thanks!

    This is your Fourth Cross Posting in last three days on same issue!!
    CHAR type column doesnt work for SORT function in ALV grid!
    How to sort a column of type CHAR
    I dont,ve link for your Fourth Thread on same,though i'm short memory loss.

  • Sort Direction in Data Grid

    Hi
    i want to know if the clicked column is sorted ASC or DESC,
    While debugging step by step, i found a property in dataGrid whis is "sortDirection"
    but this property is not accessible like this "dataGrid.sortDirection"
    is there any method to access this property.
    thank you

    Hi, for using that kind of property you have to use 'mx_internal'.
    I am putting the code here which can explore you mutch better.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    import mx.collections.*;  
    import mx.core.mx_internal;  
    use namespace mx_internal; [Bindable] 
    public var ac:ArrayCollection = new ArrayCollection([ {No:'1', Name:'Charl' },{No:
    '2', Name:'Mark' },{No:
    '3', Name:'James' },{No:
    '4', Name:'Robin' }]);
    private function onCreationComplete(): void{
    dg.mx_internal::sortDirection ="DESC" ;}
    ]]>
    </mx:Script>
    <mx:DataGrid id="dg" width="350" height="200" dataProvider="{ac}" creationComplete="onCreationComplete()">
    <mx:columns>
    <mx:DataGridColumn dataField="No"/>  
    <mx:DataGridColumn dataField="Name"/>  
    </mx:columns> 
    </mx:DataGrid>
    Hope it will help you.
    with Regards,
    Shardul Singh Bartwal

  • Advanced Data Grid Sorting / Grouping Collection

    Ok, basically here's the issue..
    I have an advanced data grid with a tree view. It goes two
    levels deep
    so:
    Report Type
    |-------------------- Company
    |--------------------------------------- Report 1
    |--------------------------------------- Report 2
    |--------------------------------------- Report 3
    |-------------------- Company 2
    |--------------------------------------- Report 1
    |--------------------------------------- Report 2
    |--------------------------------------- Report 3
    Report Type 2
    |-------------------- Company
    |--------------------------------------- Report 1
    |--------------------------------------- Report 2
    |--------------------------------------- Report 3
    |-------------------- Company 2
    |--------------------------------------- Report 1
    |--------------------------------------- Report 2
    |--------------------------------------- Report 3
    etc..
    Report and Company are Nodes (folders) and are being sorted
    alphabetically by default.
    The individual reports (Report 1,2,3, etc..) are not being
    sorted in any way that I can figure out. I need to sort them by
    date, but no matter what I've tried I can't get it to work.
    I tried a SortCompareFunction on the advancedDataGridColumn
    that displays each report, and it works *IF* I click the header...
    but if I dispatch the header_release event via AS3, nothing
    happens.
    I even set up a test:
    dg.addEventListener(AdvancedDataGridEvent.HEADER_RELEASE,heard);
    dg.dispatchEvent(
    new AdvancedDataGridEvent
    AdvancedDataGridEvent.HEADER_RELEASE,
    false,
    true,
    0, // The zero-based index of the column to sort in the
    DataGrid object's columns array.
    null,
    0,
    null,
    null,
    0
    function heard(e:Event) {
    trace("I HEAR IT!");
    trace(e.type);
    I set that up on a button so I can dispatch the event with a
    click. Every time I click the button, the header release event
    listener goes off, but the actual advanceddatagrid remains
    unchanged until I actually click on it's header..
    Any help would be *GREATLY* appreciated... I've been stuck on
    this problem for two days now :(

    "AnakinJay" <[email protected]> wrote in
    message
    news:[email protected]...
    > Ok, basically here's the issue..
    >
    > I have an advanced data grid with a tree view. It goes
    two levels deep
    > so:
    > Report Type
    > |-------------------- Company
    > |--------------------------------------- Report 1
    > |--------------------------------------- Report 2
    > |--------------------------------------- Report 3
    > |-------------------- Company 2
    > |--------------------------------------- Report 1
    > |--------------------------------------- Report 2
    > |--------------------------------------- Report 3
    >
    > Report Type 2
    > |-------------------- Company
    > |--------------------------------------- Report 1
    > |--------------------------------------- Report 2
    > |--------------------------------------- Report 3
    > |-------------------- Company 2
    > |--------------------------------------- Report 1
    > |--------------------------------------- Report 2
    > |--------------------------------------- Report 3
    > etc..
    >
    > Report and Company are Nodes (folders) and are being
    sorted alphabetically
    > by
    > default.
    > The individual reports (Report 1,2,3, etc..) are not
    being sorted in any
    > way
    > that I can figure out. I need to sort them by date, but
    no matter what
    > I've
    > tried I can't get it to work.
    >
    > I tried a SortCompareFunction on the
    advancedDataGridColumn that displays
    > each
    > report, and it works *IF* I click the header... but if I
    dispatch the
    > header_release event via AS3, nothing happens.
    >
    > I even set up a test:
    >
    dg.addEventListener(AdvancedDataGridEvent.HEADER_RELEASE,heard);
    >
    > dg.dispatchEvent(
    >
    > new AdvancedDataGridEvent
    > (
    > AdvancedDataGridEvent.HEADER_RELEASE,
    > false,
    > true,
    > 0, // The zero-based index of the column to sort in the
    DataGrid object's
    > columns array.
    > null,
    > 0,
    > null,
    > null,
    > 0
    > )
    >
    > );
    >
    > function heard(e:Event) {
    >
    > trace("I HEAR IT!");
    > trace(e.type);
    >
    > }
    >
    >
    > I set that up on a button so I can dispatch the event
    with a click. Every
    > time I click the button, the header release event
    listener goes off, but
    > the
    > actual advanceddatagrid remains unchanged until I
    actually click on it's
    > header..
    >
    > Any help would be *GREATLY* appreciated... I've been
    stuck on this problem
    > for
    > two days now :(
    Check the compareFunctions here
    http://flexdiary.blogspot.com/2008/09/groupingcollection-example-featuring.html

  • Custom sorting in data grid

    Sorting entire records
    Problem:
    Assume you have an array of 20 items (master array), and
    first 5 items are pulled into another array (paged array),
    Which is the dataprovider for the datagrid. And the datagrid
    has 10 columns.
    When the user sorts on the datagrid, sorting should happen on
    the 20 records, and
    Not on the 5 records.
    What i tried:
    Clicking on a datagrid column header will sort only the data
    provider of the datagrid. i.e., the
    5 records. In order to sort all 20 records, sorting should
    take place on the master array,
    and not on the paged array. Sorting on 20 items seems to be
    impossible.
    The only logic we could think of was that, on the
    headerRelease of datagrid, capture the
    column header clicked(not sure if you can capture it or not).
    And write custom function
    for sorting based on that column. Since there are 10 columns,
    the number of functions
    or number of blocks of code to be written will Be 10. So did
    not feel to be feasible and optimal solution.
    Please advice.

    Hello chhavs,
    If you listen to the DataGrid's headerRelease event, the event has a property columnIndex to let you know which column the user wanted to sort. So you don't need 10 functions, just one with a switch statement, which is reasonable.
    private function handleHeaderRelease(event:DataGridEvent):void
    var sort:Sort = new Sort();
    var field:SortField;
    switch (event.columnIndex)
    case 0:
    field = new SortField("fieldA");
    break;
    case 1:
    field = new SortField("fieldB");
    break;
    case ...
    sort.fields = [field];
    masterRecords.sort = sort;
    masterRecords.refresh();
    Thanks,
    Philip

  • How to save xml and xsl function to a data grid column

    hi. wondering, i have a xml and a xsl file, and have the transform class, and so need to save the xml and the xsl file, and display the results on a particular data grid column and to loop through the data grid columns. so, how do i use the xml save function
    class, any examples or point me to articles, where i can read how to do this. need to display a file, with a different colour and font. any ideas. thanks. marvin.hi. need to save a xml and xsl file and display the results on data grid. how do i do this. any
    sample code or articles i can read about thanks. marvin.
    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

    
    Hi.
    Okay, well, did ask on the msdn forums, and some one replied, and so, will paste the code he suggested.
    But getting a lot of errors.
    Can you help me out.
    Where am I going wrong.
    So, I can then get this to work, then it shows the colours and the fonts on the specified data grid.
    Can you help.
    Want to get this working and passed today if possible.
    Will pasate the code and the errors below.
    Can you help.
    Where am I going wrong.
    Marvin.
    // Set up the data set.
    DataSet ds =
    new
    DataSet();
    // Set up the data table.
    DataTable dt =
    new
    DataTable();
    // Ad the data table to the data set.
        ds.Tables.Add(dt);
    // Write the xml document to the data grid column.
        ds.WriteXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\CurrentCount.xml");
        ds.WriteXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\OnOrder.xml");
        ds.ReadXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\CurrentCount.xml");
        ds.ReadXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\OnOrder.xml");
    // Set up the data table and the data set and set to 0.
        dgvDisplayData.DataSource = ds.Tables[0];
    Error      1              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                215        
    18           WoodStocks
    Error      2              Invalid token ')' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                215        
    21           WoodStocks
    Error      3              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                219        
    16           WoodStocks
    Error      4              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                221        
    16           WoodStocks
    Error      5              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                222        
    15           WoodStocks
    Error      6              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                223        
    15           WoodStocks
    Error      7              Invalid token '=' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                227        
    31           WoodStocks
    Error      8              Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                227        
    43           WoodStocks
    Error      9              Invalid token ';' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                227        
    45           WoodStocks
    Can you help me out.
    Thanks.
    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

  • Sort on views in data grid (ORA-00904)

    Can anyone else confirm that this happens, or has been highlighted previously:
    1. Connect to any schema containing views
    2. Expand the views tree
    3. Click on any view
    4. Click on the data tab to display the data grid
    5. Click the sort button
    6. Select any column (must not exist in view selected later)
    7. Click "Apply Sort"
    8. Now click on any other view that does not contain a column of the same name as the one chosen as the sort column previously.
    I receive an ORA-00904 error. The only way I can clear this is to close down the data grid tab item, and re-open it.
    Cheers
    Carl
    DBA - Dunfermline Building Society

    Yes.
    Login as a DBA.
    Go to Other Users - SYS - Views - More - Filter - %% - OK
    Click on DBA_USERS - DATA - Sort - USERNAME - Apply Sort
    Click on DBA_USTATS
    --> ORA-00904 "USERNAME". invalid identifier.
    Notice that the columns in the data view have not changed.
    Close the tab and click on DBA_USTATS fixes the problem (no data anyway).
    Click on freeze view (the push pin) and click on DBA_USTATS fixes the problem.
    These are two easy workarounds, but it is confusing the first time you encounter it.

  • Adding a button in an Advanced Data Grid that calls a AS function

    I'm having a bit of trouble with this... maybe I'm missing something elementary.
    I have a data grid that populates.  I'd like to make the first column that currently displays the an ID display a button that executes a function that acts on the passed ID.
    I can get the button to display, but when I click it, I get an error:
    ReferenceError: Error #1069: Property userlistDeleteUserFunc not found on Main and there is no default value.
    at userGrid/__lblData_click()[C:\Users\Mike\\src\userGrid.mxml:7]
    So the grid looks like this:
    Main.mxml:
    <script tags...>
    private function userlistDeleteUserFunc(id:Number):void{
    Alert.show(id.toString());
    </script tags>
    <mx:AdvancedDataGrid x="10" y="12" id="userlistgrid" width="808" height="348" dataProvider="{userlistdata}" selectionMode="multipleCells" editable="true" enabled="true" sortableColumns="true">
    <mx:columns>
    <mx:AdvancedDataGridColumn width="90" dataField="id" headerText=" " editable="false" />
    <mx:AdvancedDataGridColumn headerText="Username" dataField="username" editable="false"/>
    <mx:AdvancedDataGridColumn headerText="Last Name" dataField="last" editable="true"/>
    <mx:AdvancedDataGridColumn headerText="First Name" dataField="first" editable="true"/>
    <mx:AdvancedDataGridColumn headerText="Email Address" dataField="email" editable="true"/>
    <mx:AdvancedDataGridColumn headerText="Phone" dataField="phone" editable="true"/>
    </mx:columns>
    <mx:rendererProviders>
    <mx:AdvancedDataGridRendererProvider dataField="id" renderer="userGrid" columnIndex="0" />
    </mx:rendererProviders>
    </mx:AdvancedDataGrid>
    And the renderer:
    userGrid.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <s:MXAdvancedDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      focusEnabled="true">
    <s:Label text="{data.id}"/>
    <s:Button id="lblData" top="0" left="0" right="0" bottom="0" label="Delete" click="{parentApplication.userlistDeleteUserFunc(data.id)}" />
    </s:MXAdvancedDataGridItemRenderer>

    Please help me !!!! I have been stuck up with this issue for the past two days and I need to atleast figure out if this is possible or not in the first place.

  • Data Grid Sort Within Portlet

    I have a portal with a portlet that contains a search form and a data grid. I have set the sortable attribute on the column to true. The sort action gets the filter service and passes it to the DB control.
    I cannot seem to get the sorting to work. The output from getSortFilterService().getDatabaseFilter(getGridName()).getOrderByClause() is always empty no matter which column I click.
    Is there something special I have to do because of the portal/portlet?
    Can someone give me a tip (or two). I realize this is a novice question but I am learning as I go and would appreciate any help.
    Edited by markml at 09/20/2007 9:41 PM

    I figured it was locking up the browser. I submitted a bug ticket several months ago concerning the same issue. If you have "enableviewstate" set to true on a datagrid and you are using the PT web controls, then the browser will lock up. It all depends on the number of rows and columns you have in the datagrid; unfortunately, I don't know the fatal number.
    However, what causes it is how Plumtree manages the viewstate itself for a datagrid. In a nutshell, they have to remember the viewstate for each single item in the grid. And the algorithm they use is extremely slow. The browser's scripting engine basically locks up because of the length of time it takes.
    Unless you absolutely need it, I would just turn off the viewstate. It disables some fancy features of the datagrid, but you can still build workarounds.
    Hope this helps/clarifies things for you!
    --JasonFTN Financial

  • Data Grid Control +JSP+Sorting

    Hi,
    Can any one help me regarding In JSP by using Data Grid Control to sort columns in table and displayed in same JSP.

    Yes! We can help! Do you have any other questions?
    Edited by: SoulTech2012 on Sep 20, 2008 11:51 AM

  • Custom System Data Grid

    Hi!
    I need a custom data grid, explaining:
    I need to made custom list of specific files, in the System data grid I can use the drag and drop files to desktop, but how I made the drag and drop work in the custom data grid of list of files?
    I tried to show in the data grid the path of the file, and drag this, but the error is:
    "Data for file list format must be an array of Files"
    But, how I made a "array of files"?
    Sorry to my bad english =)
    Thanks a lot! =)

    Hello chhavs,
    If you listen to the DataGrid's headerRelease event, the event has a property columnIndex to let you know which column the user wanted to sort. So you don't need 10 functions, just one with a switch statement, which is reasonable.
    private function handleHeaderRelease(event:DataGridEvent):void
    var sort:Sort = new Sort();
    var field:SortField;
    switch (event.columnIndex)
    case 0:
    field = new SortField("fieldA");
    break;
    case 1:
    field = new SortField("fieldB");
    break;
    case ...
    sort.fields = [field];
    masterRecords.sort = sort;
    masterRecords.refresh();
    Thanks,
    Philip

  • Data Grid Recommendation

    We are looking to add data grid functionality to our Apex app and am looking for any suggestions. Ideally it should be able to sort, resize, re-arrange and hide/show columns as well as load data asynchronously using the results of an AJAX request. Being able to resize the entire grid would also be nice.
    I have seen references to integrating ExtJS into Apex but also have seen comments that it is written for an older version. Does anyone know if this is still correct?
    I have also been looking at stand-alone jQuery plugins but am not sure how much work will be involved integrating this with Apex. Does anyone have experience with this?
    Any help, pointers, suggestions, gotchas, etc would be appreciated.
    Thanks,
    Mark

    Below is all of the JavaScript code. I found that, because Apex does not follow the standard method for passing parameters (sounds more like something Microsoft would do) you have to override the method used to send the data to the server. Also, since there is no way to change the content-type response header from 'text/html' (as far as I can find) you must also parse the resulting JSON string. Both of these actions are performed within the getPromoData function.
    I haven't done more than get the table to display with pagination working so there may be other issues I run into along the way. I shouild also note that we are using Apex 4.0 and I understand there have been improvements in AJAX processing in Apex 4.2, so that may change things (hopefully for the better).
    <link rel="stylesheet" type="text/css" media="screen" href="&WORKSPACE_IMAGES.ui.jqgrid.css" />
    <script src="&WORKSPACE_IMAGES.grid.locale-en.js" type="text/javascript"></script>
    <script src="&WORKSPACE_IMAGES.jquery.jqGrid.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    * Manually retrieve JSON data due to Apex parameter handling
    function getPromoData(pdata) {
      $.ajax({
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        url: 'f?p=&APP_ID.:&APP_PAGE_ID.:&APP_SESSION.:APPLICATION_PROCESS=Promo_Item_Query:::P70027_TABLE_PAGE,P70027_TABLE_ROWS,P70027_TABLE_SORT_INDEX,P70027_TABLE_SORT_DIR:' + pdata.page + ',' + pdata.rows + ',' + pdata.sidx + ',' + pdata.sord,
        success: function(data, textStatus) {
          try {
            var json = eval('(' + data + ')');
            $('#promoTable')[0].addJSONData(json);
          catch(e) {
            alert('Error parsing data.\n' + e);
        error: function(data, textStatus) {
          alert('Error retrieving data.\n' + textStatus);
    * Initialize the grid
    jQuery(document).ready(function(){
      jQuery("#promoTable").jqGrid({
        datatype: function(pdata) {
          getPromoData(pdata);
        mtype: 'POST',
        colNames: ['Id', 'Create Date', 'Promotion Name', 'Description', 'PH Promo Ranking'],
        colModel: [
          {name: 'id', index: 'id', width: 55, align: 'right'},
          {name: 'createDate', index: 'creation_date', formatter: 'date', align: 'right', width: 90},
          {name: 'name', index: 'name', width: 200},
          {name: 'description', index: 'description', width: 500},
          {name: 'ranking', index: 'ranking', width: 110, align: 'right'}
        pager: '#promoPager',
        rowNum: 5,
        rowList: [5, 10, 20],
        sortname: 'id',
        sortorder: 'desc',
        viewrecords: true,
        caption: 'General Promotion Setup'
    </script>

  • Display value in data grid

    08/29/2008 08:58:48 AM
    Reply | Quote | Top | Bottom | Edit
    hi all,
    i have two classes.
    class User
    public String name;
    public int age;
    public Address address;
    class Address
    public String city;
    I'm passing a List<Users> to the data provider of a
    data grid . I can display the values of properties of Users i.e,
    name and age.. My issue is how do i display the value of city which
    is a propertyt of Address class in the datagrid column..
    thanx in advance
    Mark this message as the answer.
    Print this message
    Report this to a Moderator

    Hi,
    Try labelFunction property of the DataGridColumn.
    labelFunction allow you to specify a function name, which will be
    invoked when that data is rendered. You will get the Object (User
    id your case) corresponding the row being rendered will be passed
    as argument to the function. You can use the object and return the
    value you want to be displayed.
    Please find more details on labelFunction at the URL below
    http://livedocs.adobe.com/flex/3/langref/mx/controls/dataGridClasses/DataGridColumn.html#l abelFunction
    You can also try custom item renderer.
    Hope this helps.

  • FillBy always fills in the same row in data grid view. How to make it fill in a new row for each click of the Fillby Button? VB 2010 EXPRESS?

    Hi there, 
    I am a beginner in Visual Basic Express 2010. I have a Point of Sale program that uses DataGridView to display records from an external microsoft access
    database using the fillby query. 
    It works, but it repopulates the same row each time, but i want to be able to display multiple records at the same time, a new row should be filled for
    each click of the fillby button. 
    also I want to be able to delete any records if the customer suddenly decides to not buy an item after it has already been entered. 
    so actually 2 questions here: 
    1. how to populate a new row for each click of the fillby button 
    2. how to delete records from data grid view after an item has been entered 
    Thanks 
    Vishwas

    Hello,
    The FillBy method loads data according to what the results are from the SELECT statement, so if there is one row then you get one row in the DataGridView, have two rows then two rows show up.
    Some examples
    Form load populates our dataset with all data as it was defined with a plain SELECT statement. Button1 loads via a query I created after the fact to filter on a column, the next button adds a new row to the existing data. When adding a new row it is appended
    to the current data displayed and the primary key is a negative value but the new key is shown after pressing the save button on the BindingNavigator or there are other ways to get the new key by manually adding the row to the backend table bypassing the Adapter.
    The following article with code shows this but does not address adapters.
    Conceptually speaking the code in the second code block shows how to get the new key
    Public Class Form1
    Private Sub StudentsBindingNavigatorSaveItem_Click(
    sender As Object, e As EventArgs) Handles StudentsBindingNavigatorSaveItem.Click
    Me.Validate()
    Me.StudentsBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.MyDataSet)
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'MyDataSet.Students' table. You can move, or remove it, as needed.
    Me.StudentsTableAdapter.Fill(Me.MyDataSet.Students)
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Me.StudentsTableAdapter.FillBy(Me.MyDataSet.Students, ComboBox1.Text)
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    Me.MyDataSet.Students.AddStudentsRow("Jane", "Adams", "Female")
    End Sub
    End Class
    Get new key taken from
    this article.
    Public Function AddNewRow(ByVal sender As Customer, ByRef Identfier As Integer) As Boolean
    Dim Success As Boolean = True
    Try
    Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
    Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
    cmd.CommandText = InsertStatement
    cmd.Parameters.AddWithValue("@CompanyName", sender.CompanyName)
    cmd.Parameters.AddWithValue("@ContactName", sender.ContactName)
    cmd.Parameters.AddWithValue("@ContactTitle", sender.ContactTitle)
    cn.Open()
    cmd.ExecuteNonQuery()
    cmd.CommandText = "Select @@Identity"
    Identfier = CInt(cmd.ExecuteScalar)
    End Using
    End Using
    Catch ex As Exception
    Success = False
    End Try
    Return Success
    End Function
    In closing I have not given you a solution but hopefully given you some stuff/logic to assist with this issue, if not perhaps I missed what you want conceptually speaking.
    Additional resources
    http://msdn.microsoft.com/en-us/library/fxsa23t6.aspx
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • Problem in Data Grid

    Hi All,
    Account calculations are not displaying on the data grid. But the values are being picked up with a smart view report.
    I tried running a force calculate and a consolidate all, but that did not work.
    Please suggest in this regards.
    Thanks in advance....

    I tried to use your algorithm to modify my code but i am not able to do that. For this example i am not using any httpservice i am  using data services. I created a PHP file i just need to import it into data services planel and drag that services onto data grid it will automatically bring all the data into that data grid.  Can you tell me what i need to modify to achive my goal. am using following code
    protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
    getHorizontalCommentResult.token = horizontalCommentsService.getHorizontalComment();
    <mx:DataGrid x="159" y="123" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getHorizontalCommentResult.lastResult}" height="223" width="245">
    <mx:columns>
    <mx:DataGridColumn headerText="Comments" dataField="Comments"/>
    </mx:columns>
    PP file
    <?php
    class HorizontalCommentsService{
    public function getHorizontalComment() {
    $connection = mysqli_connect("localhost", "root", "root", "my_db", 8889) or die(mysqli_connect_error());
    $sql = "SELECT * FROM photo_comments ORDER BY Image_ID DESC";
    $result = mysqli_query($connection, $sql) or die('Query Failed: ' . mysql_error($connection));
    $rows = array();
    while($row = mysqli_fetch_object($result)) {
    $rows[ ] = $row;
    return $rows;
    ?>

Maybe you are looking for

  • How to use FTP_COMMAND to put a file in the target system

    Hi All, I have the requirement to put an excel file from apllication server to another remote system for this i am using the function modules 1) FTP_CONNECT to connect to the sourece as well as the destination systems  --- Here i am able to hit the b

  • Macbook pro to macbook pro via wireless router

    I have 2 Macbook pro's, I want to have one control the other that will be connected to an LED wall control system, (usb A B) for me to set up the control system I have to be about 30' away from it. I will be using a netgear N600 wireless router conne

  • ITunes Library File in Documents Folder? Mac problem not Windows

    I am confused! I have several very small iTunes Library folders in my Music/iTunes file which date back to iTunes 4. Some of the files are less than 10kb. I also have a folder titled Previous Libraries in my Music/iTunes file which has two Libraries

  • Which camcorder to purchase

    Hi, I have recently purchased CS4 Premiere and looking to buy an HD camera with built in hard drive. I have around £600 to spend. There is so much choice I was hoping somebody could recomend one which has good picture quaility and is supported by Pre

  • Upload Data Periodically using FV75 based on Customer No

    Hi Guys, I'm very new to SAP. Here i'm facing one problem that i've to upload Data from File to SAP for FV75 transaction. I tried Recording but it's not possible. Then i tried BAPI like MRM_PARKED_INVOICE_ACCDATA,  AC_DOCUMENT_PARKING_NO_UPDATE, and