A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: problem in datagrid

  1. #1
    Junior Member
    Join Date
    Feb 2008
    Posts
    2

    problem in datagrid

    Hi All,
    I am new in action script.... i need help from you..
    i have the problem in datagrid... The problem is i inserted a array values into datagrid using dataprovider .The datagrid contains three columns . The columns are automatically change the column order for example..
    first column : ID
    second column : Name
    Third column ; Place

    i assign a values to datagrid like above... but the changes the column order automatically run this code whenever.. like 1st coumn : Name 2nd column ; Place 3rd Column :ID .... next time 1st coumn : ID 2nd column ; Place 3rd Column :Name

    thanks in advance....

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Your explanation is not clear. Can you show a script only what you do with the datagrid.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    Feb 2008
    Posts
    2

    Hi cancerinform ....

    Quote Originally Posted by cancerinform
    Your explanation is not clear. Can you show a script only what you do with the datagrid.
    //courseList_dg is the datagrid. i have inserted three arrays in various conditions.. when i insert one array to datagrid i clear the datagrid first and then only i insert the array.
    //this is my code

    var xmlLoader:URLLoader = new URLLoader();
    var xmlData:XML = new XML();

    xmlLoader.load(new URLRequest("DomainDetail.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

    /* Reading the Various Domain names*/
    function LoadXML(e:Event):void
    {
    xmlData = new XML(e.target.data);
    }

    function getDomain(myevent:Event)
    {
    var lst:List = myevent.currentTarget as List;
    selectedDomain=lst.selectedItem.data;
    displayDomain1(selectedDomain);
    domainStart_list.clearSelection();
    }

    function displayDomain1(selectedDomain)
    {
    //Adds the domName array to the domain_list
    var displayDomainObject:displayDomain=new displayDomain();
    domain_list.dataProvider = new DataProvider(displayDomainObject.displayDomainFn(x mlData,selectedDomain));
    domain_list.visible=true;
    domain_list.addEventListener(Event.CHANGE, getDomainID);
    }

    var selectedDomainID:String;
    //Gets the selected Domain ID
    function getDomainID(myevent:Event)
    {
    var lst:List = myevent.currentTarget as List;
    selectedDomainID=lst.selectedItem.data;
    selectedDID=lst.selectedItem.data;
    domain_list.clearSelection();
    getdomainID1(selectedDomainID);
    }

    function getdomainID1(selectedDomainID:String)
    {
    courseList_dg.removeAllColumns();
    if (selectedDomainID=="allDomains")
    {
    var allDoaminObject:AllDomain=new AllDomain();
    courseList_dg.dataProvider=new DataProvider(allDoaminObject.AllDomainFn(xmlData)) ;
    courseList_dg.visible=true;
    courseList_dg.getColumnAt(0).width = 80;
    }

    else if(selectedDomainID=="search")
    {

    searchCourseArray=searchCourseObject.searchCourseF n(xmlData,findKeyword);

    courseList_dg.dataProvider=new DataProvider(searchCourseObject.searchCourseFn(xml Data,findKeyword));
    courseList_dg.getColumnAt(2).width = 450;
    courseList_dg.getColumnAt(1).width = 80;
    courseList_dg.visible=true;

    }

    else
    {
    var individualDomainObject:individualDomain=new individualDomain();
    courseList_dg.dataProvider=new DataProvider(individualDomainObject.searchCourseTi tle(xmlData,selectedDomainID));
    courseList_dg.visible=true;
    courseList_dg.getColumnAt(0).width = 80;

    }
    courseList_dg.addEventListener(Event.CHANGE,getCou rseID);
    }

    var Scid:String=new String();
    function getCourseID(myevent1:Event)
    {
    var selectedCourseID=myevent1.target.selectedItem.cour seID;
    Scid=selectedCourseID;
    if (selectedCourseID!="Course ID" && selectedCourseID.charAt(0)!="D" && selectedCourseID!=" " )
    {
    selectedDomain=courseDetailObject.courseDetailFn(x mlData,Scid);

    displayDomain1(selectedDomain.charAt(0));
    courseList_dg.clearSelection();
    }

    }

    search_btn.addEventListener(MouseEvent.CLICK,searc h1);
    function search1(searchEvent:MouseEvent):void
    {
    selectedDomainID="search";
    getdomainID1(selectedDomainID);
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center