SNF Rapid Development Platform mvc-free sequencing components

Source: Internet
Author: User

1. Use the free sorting function

In some need to sort the priority of the data to adjust processing, such as national data, in the north when the implementation of the Han more, hoping to put the Han in the first place. Mongolian people put the Mongolian in the first choice when the project was implemented in Mongolia.

1.1. Effect Display

Figure 1.1

1.2. Call Description 1.2.1. Defining a free-ranking model

This.freesort = new Snf.freesortoptionsmodel ();//Free sort model

Self.freeSort.set ({

Grid:self.grid,

NameSpace: "Tony.DEMO.Business",

TableName: "Demosingletable",

SortField: "Sortcode",

Flagdatabase:false

});

Location: This method call should be after the This.grid object is defined, otherwise it will not be recognized

1.2.2. Parameter description

Grid: Table object that needs to be sorted now

Namespace:service namespaces for classes of layers

TableName: Data table name

SortField: Sort field (default Sortcode)

Flagdatabase: After each move, whether to save the database (true indicates that the database is saved after the move, false indicates that only the display is changed, it needs to be stored uniformly, by default true)

The DataSet for the project in which the class for the Projectnamespace:service layer is located, by default equals namespace (when used primarily for namespaces and when the project is different)

1.2.3. Event bindings that move up and down

Snf.gridupmove (self.freesort); Move up

Snf. Griddownmove (self.freesort); Move down.

Snf. Gridfirstmove (Self.freesort);

Snf. Gridlastmove (Self.freesort);

, the checkinserted event in the figure is the end of the validation line edit, and if Flagdatabase=true does not require this event

Figure 1.2

1.2.4. Row edit Unified Save model Call

After defining the DataGrid object (that is, the object that defines and binds the table's properties) and the free-sort model, add an automatic comparison of the current content and initial values of the table to get a model that changes the row:

This.gridmatch = new Snf.matchgridviewmodel (Self.grid, Self.freesort);

The Onloadsuccess event needs to be increased by self.gridMatch.setDefault () in the object defined by the DataGrid;

Rewrite the Saveclick event, post.list to Post.list = Self.gridMatch.getChanges (self.setting.postListFields);

Figure 1.3

The This.gridmatch method in the figure is to define a model that matches the changed rows, and the third line in the This.saveclick is to call the data that reads the changed rows. The This.gridmatch method should be called after the table's object and free-sort model definitions are complete, otherwise it will not work

1.2.5. Precautions

Note that the order of the individual methods cannot be reversed, the DataGrid object is defined at the top, followed by the definition of the free-sort model Freesortoptionsmodel, then the definition moves down the event, and then defines the model that automatically compares the content for the change row Matchgridviewmodel , the last is to save the event line edit, the new row is no sorting code, so the current page if there is new data can not be allowed to sort, to be saved before allowing sorting use free sorting when you do not use paging

1.2.6. Demo sample

Program Path:

/demo/demosingletablefreesort/demosingletablefreesort

You can add a menu view in your program by following this path

SNF Rapid Development Platform mvc-free sequencing components

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.