Update datagrid

Hi,
     In my project i had included number of components.In one component i need to update data from a table and have to display in the same page after clicking the update button.I cannot refresh refresh the datagrid. so i just called the datagrid creation complete handler but showing one error like
"cannot access property or method of null object reference"
whats the solution??
Thanks in advance.
sreejaVirtus

i had used data services
i cant send full code...so i m sending the needed part.
protected  function dataGrid_creationCompleteHandler():void
getAllFlex_classroomResult.token = flexclassroomService.getAllFlex_classroom();
protected 
function btn_update_clickHandler(event:MouseEvent):void{
var item:Flex_classroom=new Flex_classroom();item.id=dataGrid.selectedItem.id;
item.classroom=txt_classroom.text;
if(rb_private.selected==true){
item.type=
"Private";}
if(rb_public.selected==true){
item.type=
"Public";}
updateFlex_classroomResult.token = flexclassroomService.updateFlex_classroom(item);
if(updateFlex_classroomResult.token){
Alert.show(
"Classroom has been updated successfully!");dataGrid.dataProvider=getAllFlex_classroomResult.lastResult;
while clicking on the button it need to a message and list the updated data in the same page.
thanks in advance.

Similar Messages

  • Undefined error: when update datagrid in flex

    I get this error when trying to update a field in my datagrid, using LCDS 2.61 with coldfusion.
    Why?
    undefined
        at mx.data::CommitResponder/result()[C:\depot\flex\branches\enterprise_bridgeman_final_hotfi xes\frameworks\mx\data\CommitResponder.as:424]
        at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\ AsyncRequest.as:74]
        at NetConnectionMessageResponder/resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\ src\mx\messaging\channels\NetConnectionChannel.as:515]
        at mx.messaging::MessageResponder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx \messaging\MessageResponder.as:199]
    Thanks,
    Jon Kravetz

    To troubleshoot this, you should add <mx:TraceTarget /> to your mxml file and then debug your application.  Afterwards, reply with the trace log from the console...

  • Update Datagrid without refreshing

    Hi everyone!
    Is there a way to refresh a datagrid without clicking a button or refreshing the page if a new entry was inserted into the database.
    Example:
    A new name is inserted in the database, my datagrid will automatically update, it's like real time in updating.
    thank you very much!

    re-Flexing wrote:
    Hi everyone!
    Is there a way to refresh a datagrid without clicking a button or refreshing the page if a new entry was inserted into the database.
    Example:
    A new name is inserted in the database, my datagrid will automatically update, it's like real time in updating.
    thank you very much!
    what kind of project are you going to be including it in?
    commerical? personal?
    or are you just messing around with code?
    messing around/personal usage, i'd suggest a script acting on a timer request to check the database for any new entries.
    with a fully commerical project, you'd have to go the route of developing your own system with the implementation of a send/listener procedure, or as already mentioned, buy a pre-built one.

  • Update DataGrid using RemoteObject

    I am using a RemoteObject method call to populate an ArrayCollection used as a dataProvider in my DataGrid. I use the render() method on the datagrid to make sure the datagrid displays the updated data the RemoteObject method is returning everytime it is displayed. My problem is the datagrid displays the updated information but gets into an infinite call.
    What might be the appropriate way to get the updated data from the backend?
    -Thanks,
    Fauzia

    Hi Michael,
    Thanks for your reply. The AC I use is bindable, but it doesn't get update with an initialize() method, thats why I had to use render(). This is an outline of my code...
      <mx:RemoteObject id="historyService" result="onResultGetList(event)" showBusyCursor="true" fault="onFault(event)" destination="historyService">
         <mx:method name="getLrcFindDetailCltn" result="onResultGetList(event)" makeObjectsBindable="true" fault="onFault(event)"/>
       </mx:RemoteObject>
           [Bindable]
            private var ldsDetails:ArrayCollection;
              public function getList():void
                historyService.getLrcFindDetailCltn();
              public function onResultGetList(event:ResultEvent):void
                 ldsDetails = event.result as ArrayCollection;
    <mx:DataGrid id="usersDataGrid" dataProvider="{ldsDetails}" render="getList();">
    <mx:columns>......
    Thanks,
    Fauzia

  • It seems there is no any updatable datagrid in jsp

    HI
    I am looking for an updatable,editable datagrid for my webapp?anyone knows one? even using struts,...
    Thank u

    JSF will handle most of the donkey work for you with its DataTable component

  • Use timer to poll HTTPService, update DataGrid

    Hi I am trying to adapt Tracy Spratt's example of using a
    timed event to poll HTTPService to my own small application, and I
    am somewhat confused on a couple of points.
    Looking at the code, here
    http://www.cflex.net/showFileDetails.cfm?ObjectID=560&Object=File&ChannelID=1
    I see a script, a datagrid, an HTTPService call, I don't see
    where the script is being called or where the whole thing is
    initiated....?
    D

    See the FB3 help topic: The Timer Class
    The Timer object dispatches a TimerEvent object each time the
    given interval is reached. So once you set up the timer and the
    event handler and call timer.start() it all works:
    timer.addEventListener(TimerEvent.TIMER, onTimer);

  • Use buttons to update DataGrid

    I'm trying up make a datagrid with a list of buttons that,
    when pressed, will populate the data grid with filtered information
    from a XML file.
    Thanks for any help and suggestions?

    I did an app which gets XML data via an HTTPService, to which
    I assigned the name getData.
    The button code invokes the HTTPService like this:
    <mx:Button x="78" y="38" label="Launch"
    click="getData.send() "/>
    When using Flex, the Cache can be an issue with refresh
    though on deployment, you may need to pass a unique value appended
    to the name of your XML file, a lot of people use the system data
    and time like this:
    xmlPath = "data.xml?unique=" + String(Date.parse(new
    Date()));

  • Update DataGrid over ArrayCollection

    Hey,
    I have got a problem with the updating capabiliy of the
    ArrayCollection.
    I fill the array like this.
    quote:
    [Bindable]
    private var content:ArrayCollection = new ArrayCollection();
    private function contentRPCResult(event:ResultEvent):void {
    content = event.result.allEntries.entry;
    The data I like to fill the ArrayCollection with, is
    information I got from a mysql database over PHP. It needs to be
    reloaded from time to time, because the content changes quiet
    frequently. So I used a "Refresh" button. While clicking on it the
    RPC "contentRPC.send();" gets sent again. The command works fine,
    because the first time the database content loads into the app.
    If I click on the refresh button, nothing happens. I thought,
    if the content of an ArrayCollection changes, the content of its
    dataprovider changes as well?! I used an XMLListCOllection in
    another app, there it works. If I send the HTTPRquest again, the
    content changes if there were any changes since the last load.
    I even tried removeAll() or refresh() to empty the Array and
    fill it again with the new data. It doesn't work. Only the first
    loaded content is displayed in the data provider. If i reload the
    whole app, the content shows the actuall content (which is the
    first loaded content, indeed!).
    So my question is: I fill an ArrayCollection with
    "contentRPC.send();" (HTTPRequest) once. The dataprovider shows the
    content. When I user "contentRPC.send()" again and the new content
    is different to the old one, how could I refill the ArrayCollection
    with the new content (it should automatically change the content of
    the dataprovider)?
    Hopefully you understand my problem. I am actually German, so
    it was hard for me to explain, what I really intend to do!
    Thanks for any help.
    greets lindner

    Hey Vygo,
    thank you for your answer. Unfurtunatly it is not a cache
    problem. I tried the unique thing, which sounds very meaningful.
    But the ArrayCollection still gets not refreshed, or reloaded. When
    I use the PHP Script on its own, it always shows the current
    content, using no cache at all. So I know the right content gets
    passed to the flex app, but the app does not use it!
    Any other suggestions, maybe there is a cache problem in
    flex?
    I just took a look in the older app where I used an
    XMLListCollection to fill the dataprovider.
    There the command to gill the XMLListCollection was
    "HTTPRequest_ID.
    lastResult.XML_node". Now I fill the ArrayCollection only
    with "content = event.
    result.allEntries.entry;". I can not use lastResult at this
    point. Might this be a problem? I an't believe there is no way to
    fill an ArrayCollection at runtime more than one time?!
    greetings lindner

  • Datagrid data update

    Hi!
    I'm new in flex and have a problem with datagrid.
    I'm using httpservice to get data. At some time I make new
    data request to check for changes. How can I compare the old and
    the new data and update the datagrid only if there are differences?
    I want this, because by every update datagrid loses its selection
    and scroll position.

    Hii,
    You can compare two object using
    ObjectUtil.compare(object1,object2).which return 0 if your objects
    are same or return -1 if they are not same.
    You cam pass your previous object and current object into
    compare function and you can check.
    I have made sample application which compare two objects:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="init()">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.utils.ObjectUtil;
    public var object1:Object;
    public var object2:Object;
    public function init():void
    object1 = new Object();
    object2 = new Object();
    object1.name = "ruchi";
    object1.id = "2";
    object2.name = "ruchi";
    object2.id = "2";
    public function compare():void
    var i:int = ObjectUtil.compare(object1,object2);
    Alert.show(i+"");
    ]]>
    </mx:Script>
    <mx:Button x="34" y="10" label="Button"
    click="compare()"/>
    </mx:Application>
    I think it may be help to you.
    thanks,
    Megha Shah

  • Updating a table on DB considering changes on a grid in Csharp

    I'm filling a Data Grid in C# (WinForms) via a System.Data.DataTable. DataTable is filled from a DB table via ODP.
    I have a data navigator in Data Grid for updating, deleting and inserting rows.
    I want to use DataTable to commit all changes made in Data Grid to the database.
    I have to use OracleDataAdapter but I couldn't figure out how to achieve this.
    What kind of a CommandText should I use to achieve all three commands (update, delete, insert)?
    The code below didn't work (maybe because CommandText I inserted is not appropriate)
    public void ExecuteNonQuery(string commandText, OracleCommand oracleCommand, CommandType commandType, DataTable dataTable)
    oracleCommand.CommandText = commandText;
    oracleCommand.CommandType = commandType;
    try
    oracleCommand.Connection = m_Connection;
    OracleDataAdapter oracleDataAdapter = new OracleDataAdapter(oracleCommand);
    oracleDataAdapter.Update(dataTable);
    catch (Exception)
    LoggerTrace.Instance.Write(TraceEventType.Error, LoggerTrace.LoggerTraceSource.DatabaseManagerError, "Query could not be executed!");
    throw;
    }

    Hey,
    use the update method of the dataadapter object and the adatagrid input object: <adapater>.update(<datagrid>)
    but i think you post in the wrong forum.
    Use the knowledge base of Microsoft and .Net!
    Marcel
    Edited by: Marcel S. on 27.05.2013 11:12

  • ComboBox as a custom renderer

    I am working on something more complex than a classic combo in a dataGrid. As a general rule, what exactly populates dataGrid with the selected value? What is a design pattern to update dataGrid with a value from combobox?
    Thanks

    The DataGrid should be populated using a collection, like ArrayCollection or XMLListCollection.
    The ComboBox used as a dataRenderer in the DataGrid should update the dataProvider when user selects a new value.
    If this post answers your question or helps, please mark it as such.

  • Calling HTTPService from Flex

    Hi,
    I know how to call a HTTPService in actionscript as follow.  I was wondering how to call HTTPService in Flex (not from actionscript).
        post_submit_tn_service.send();
        <mx:HTTPService id="myservice"
        </mx:HTTPService>

    Hi,
    Here is my problem.
    Let's assume I have two mxml files.
    The mxml file2 contains HTTPService which is called in a ViewStack from file1.
    When ViewStack is set to file2 for the second time (to update datagride), createComplete in file2 is not being called. So, no HTTPService is called when ViewStack is set to file2 for the second time.
        <!-- file1 -->
        <mx:ViewStack id="vsMyStack" x="0" y="0" width="100%" height="100%" >
              <mx:Canvas id="file1" label="Login" width="100%" height="100%">
             </mx:Canvas>
            <mx:TabNavigator id="viewstack1" width="100%" height="100%">
                <views:file2 width="100%" height="100%"/>
                <views:file3 width="100%" height="100%"/>
              </mx:TabNavigator>
        </mx:ViewStack>
    <!-- file2 ->
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();">
        private function init():void
            post_service.send();
        <mx:HTTPService id="post_service"
            url="http://localhost/prod-ar/webservices/get_day_of_year.php"
            method="POST"
        </mx:HTTPService>
    </mx:VBox>

  • How to update 2 datagrids in 2 different app at the same time?

    I'm very new to flex/flash builder and my question is: first I have to explain how the applications works. The first applications have a form for a customer to fill and datagrid to show the results.The data is send using PHP to a database in the server. The second application have a datagrid for the admin  that show the data that the first application send. Now, when  the data is inserted in the database, the first application dataGrid show the result soon as the records are inserted in the database, but the second application show the records after I refresh the Browser. The second aplication have a delete button to clear records from the database as is obious, the firstt database needs to be refreshed in order to see if the record has been deleted. So what I need is that both applications update as soon as the database is altered.If anyone have a suggestion I appreciate very much thanks in advance.

    Then, the time interval should be implemented in both applications since the first one inserts data and the second one delete the data. Instead of doing time interval I eliminate the second app and make 'states' in the first app for the 'add' and 'delete' data so I was able to open two instances of the app, one using the add state and the other with the delete state thinking that since was the same application both update at the same time but unfortunately I was wrong and one needs the browser refresh anyway. I really not know how to do time interval in flex since is different to flash that you just do the interval for the next frame and back to the first to load the data since is a timeline based app, flex not, besides, I'm just start using flex a couple weeks ago and don't know much about the coding  but I will keep researching to do that. Thanks for the advice and sorry to take so long to answer.

  • Datagrid dataprovider not updated after filterfunction/refresh applied.

    I have a datagrid that has about 100 or so rows backed by an arrayCollection - no problems. I use a list of "topics" to filter the view in the datagrid, using a filterfunction assigned to the arrayCollection - no problem. The only editable data in the grid is a single column boolean value represented by a checkbox using an itemrenderer - no problem.
    Problem: I change the state of several checkboxes for my current topic, I select a new topic, then change some check boxes under that topic. When I return to the first topic, the checkboxes are no longer checked - everything is as it was before. I would have thought the arraycollection (dataprovider) was getting updated when I changed the values of the checkboxes, but this does not appear to be the case.
    So, do I need to handle an event to update the dataprovider manually before I change to a new topic, or should it work like I described and I am doing something wrong?
    Thanks.

    Well that would be the problem then. Sometimes this can be done automatically, but most of the time there are some additional considerations you need to take. It sounds like maybe the data state of the render is getting wiped out before the edit is committed.
    I suggest skimming over the following:
    http://livedocs.adobe.com/flex/3/html/celleditor_1.html
    Cheers!

  • DataGrid ComboBox itemRenderer/editor not updating dataProvider properly

    I have a DataGrid with one column using a ComboBox as the itemRenderer. The column is editable but if you trace the dataProvider, the changes lag behind by one. So uncheck two row's ComboBox and the dataProvider only shows one row's data updated.
    Any ideas?

    Yep, its a CheckBox, too early in the morning.
    Another component (DataGrid) will be filtered depending on what rows in the ADG have their CheckBox checked, so leaving the row may be too late.
    Here is the code I have so far. In the itemEditEnd event handler I'm trying to set the field in the dataProvider manually, but it causes an infinite loop. preventDefault and stopImmediatePropagation don't help.
    ----- CheckBoxRenderer.mxml -----
    <?xml version="1.0"?>
    <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
        <![CDATA[
          import mx.controls.CheckBox;
          [Bindable] public var newSelected:Boolean;
        ]]>
      </mx:Script>
      <mx:CheckBox id="selectedChbx" selected="{data.FLAG}"/>
    </mx:VBox>
    ----- mainapp.mxml -----
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
        <![CDATA[
          import mx.events.AdvancedDataGridEvent;
          import mx.collections.ArrayCollection;
          import mx.controls.CheckBox;
          [Bindable] private var transactions:ArrayCollection = new ArrayCollection([
            {orderID: "33725", theirOrderNumber: "10170", name: "Bob Smith", SKUs: "21", PICKS: "50", FLAG: "true"},
            {orderID: "33729", theirOrderNumber: "10172", name: "Mary Wilson", SKUs: "3", PICKS: "6", FLAG: "true"},
            {orderID: "33730", theirOrderNumber: "10176", name: "Fred Carson", SKUs: "1", PICKS: "2", FLAG: "true"},
            {orderID: "33731", theirOrderNumber: "10177", name: "Morten Hills", SKUs: "5", PICKS: "16", FLAG: "true"},
            {orderID: "33732", theirOrderNumber: "10178", name: "Bill Trundy", SKUs: "5", PICKS: "34", FLAG: "true"},
            {orderID: "33734", theirOrderNumber: "10179", name: "Ocean Boat Supply", SKUs: "8", PICKS: "19", FLAG: "true"},
            {orderID: "33736", theirOrderNumber: "10180", name: "Janet Aberdine", SKUs: "5", PICKS: "18", FLAG: "true"},
            {orderID: "33737", theirOrderNumber: "10181", name: "Kim Restine", SKUs: "2", PICKS: "6", FLAG: "true"},
            {orderID: "33738", theirOrderNumber: "10182", name: "Thomas Overby", SKUs: "5", PICKS: "12", FLAG: "true"}
          public function handleGridChanged(evt:AdvancedDataGridEvent):void{
            var newData:Boolean = CheckBoxRenderer(evt.currentTarget.itemEditorInstance).newSelected;
            trace(evt.rowIndex);
            var obj:Object = transactions.getItemAt(evt.rowIndex);
            trace("BEFORE: " + obj.FLAG);
            obj.FLAG = newData;
            trace("AFTER: " + obj.FLAG);
            transactions.setItemAt(obj, evt.rowIndex);
            return;
            evt.preventDefault();
            evt.stopImmediatePropagation();
    //        for each(var item:Object in transactions){
              //trace(item.FLAG);
        ]]>
      </mx:Script>
      <mx:Label fontSize="12" text="Bulk Print / Pull - Step 1"/>
      <mx:HBox>
        <mx:AdvancedDataGrid id="dgTransactions" dataProvider="{transactions}"
          fontSize="12" editable="true" sortableColumns="true" height="500"
          width="100%" itemEditEnd="handleGridChanged(event);">
            <mx:columns>
              <mx:AdvancedDataGridColumn dataField="orderID" headerText="WMSOID" width="100"
                editable="false" textAlign="center"/>
              <mx:AdvancedDataGridColumn dataField="theirOrderNumber" headerText="Order #"
                textAlign="center" width="130" editable="false"/>
              <mx:AdvancedDataGridColumn dataField="name" headerText="Customer"
                width="125" textAlign="left" editable="false"/>
              <mx:AdvancedDataGridColumn dataField="SKUs" headerText="SKU's"
                width="75" textAlign="right" editable="false"/>
              <mx:AdvancedDataGridColumn dataField="PICKS" headerText="Picks"
                width="75" textAlign="right" editable="false"/>    
              <mx:AdvancedDataGridColumn dataField="FLAG" headerText="I" width="20" textAlign="center"
                editable="true" rendererIsEditor="true" editorDataField="newSelected"
                itemRenderer="CheckBoxRenderer"/>
            </mx:columns>
        </mx:AdvancedDataGrid>
        <mx:DataGrid>
        </mx:DataGrid>
      </mx:HBox>
    </mx:Application>

Maybe you are looking for